Professional Documents
Culture Documents
http://dbarajabaskar.blogspot.com/
Rajabaskar Thangaraj
www.dbarajabaskar.blogspot.com
1
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
A user accidentally dropped a table in production database. We have a proper RMAN backup.
For this we need an outage for the application. So we using prior backup to clone the database &
export the table and import into production. Our database is very huge database. So restoration is
very difficult.
That time we used skip tablespace feature. Restore the corresponding tablespace, system, and undo
& sysaux tablespace. To reduce the restoration downtime & avoid the space issue.
Environment Details:
RMAN before restore the datafiles its skip the mentioned skip tablespace belonging datafiles.
That datafiles are offline before restore operation is performed. After recovery, its remove the
skip tablespace information from current control file.
Tablespace created.
2
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
Tablespace created.
User created.
Grant succeeded.
Table created.
Index created.
Tablespace created.
Tablespace created.
User created.
Grant succeeded.
3
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
Table created.
Index created.
TABLESPACE_NAME FILE_NAME
-------------------- --------------------------------------------
-
USERS D:\ORACLE\APP\ORADATA\CHE\USERS01.DBF
UNDOTBS1 D:\ORACLE\APP\ORADATA\CHE\UNDOTBS01.DBF
SYSAUX D:\ORACLE\APP\ORADATA\CHE\SYSAUX01.DBF
SYSTEM D:\ORACLE\APP\ORADATA\CHE\SYSTEM01.DBF
EXAMPLE D:\ORACLE\APP\ORADATA\CHE\EXAMPLE01.DBF
RAJA_DATA D:\ORACLE\APP\ORADATA\CHE\RAJA_DATA01.DBF
RAJA_INDX D:\ORACLE\APP\ORADATA\CHE\RAJA_INDX01.DBF
TEST_DATA D:\ORACLE\APP\ORADATA\CHE\TEST_DATA01.DBF
TEST_INDX D:\ORACLE\APP\ORADATA\CHE\TEST_INDX01.DBF
9 rows selected.
C:\>set oracle_sid=che
C:\>rman
4
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
5
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
piece
handle=D:\ORACLE\APP\FLASH_RECOVERY_AREA\CHE\BACKUPSET\2010_05_13\O1_MF_NC
SNF_TAG20100513T171404_5YQSLKSD_.BKP tag=TAG20100513T171404 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-MAY-10
Listener configuration:
SID_LIST_LISTENER11G=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=che)
(SID_NAME=che)
(ORACLE_HOME=D:\Oracle\app\11.1.0\db_1)
)
(SID_DESC=
(GLOBAL_DBNAME=clonedb)
(SID_NAME=clonedb)
(ORACLE_HOME=D:\Oracle\app\11.1.0\db_1)
)
)
)
TNS configuration:
CHE =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = che)(PORT = 1522))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = che)
)
6
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
CLONEDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = che)(PORT = 1522))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = clonedb)
)
)
4. Create the instance using oradim utility ( applicable for windows platform)
C:\>orapwd file=D:\Oracle\app\11.1.0\db_1\dbs\orapwCLONEDB
password=clonedbadmin entries=20
Che database: We create the pfile for clonedb from che database & edit the parameter.
File created.
Init parameter change “clonedb” instead of che & use to start the Clonedb.
clonedb.__db_cache_size=130023424
clonedb.__java_pool_size=12582912
clonedb.__large_pool_size=4194304
clonedb.__oracle_base='D:\Oracle\app'#ORACLE_BASE set from environment
clonedb.__pga_aggregate_target=192937984
clonedb.__sga_target=348127232
clonedb.__shared_io_pool_size=0
7
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
clonedb.__shared_pool_size=184549376
clonedb.__streams_pool_size=8388608
*.audit_file_dest='D:\Oracle\app\admin\clonedb\adump'
*.audit_trail='db'
*.compatible='11.1.0.0.0'
*.control_files='D:\Oracle\app\oradata\clonedb\control01.ctl','D:\Oracle\app\oradata\clone
db\control02.ctl','D:\Oracle\app\oradata\clonedb\control03.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='clonedb'
*.diagnostic_dest='D:\Oracle\app'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=clonedbXDB)'
*.log_archive_dest='D:\Oracle\app\archive\clonedb'
*.log_archive_start=TRUE
*.memory_target=538968064
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.skip_unusable_indexes=TRUE
*.undo_tablespace='UNDOTBS1'
db_file_name_convert =
('D:\ORACLE\APP\ORADATA\CHE','D:\ORACLE\APP\ORADATA\CLONEDB')
log_file_name_convert =
('D:\ORACLE\APP\ORADATA\CHE','D:\ORACLE\APP\ORADATA\CLONEDB')
7. Create the appropriate folder for clonedb database (admin/oradata folders etc..)
C:\>set oracle_sid=clonedb
C:\>sqlplus
8
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
DATE
-------------------
13-05-2010 17:27:20
Table dropped.
While recovery, we cloning the database & skip the remaining tablespace (TEST_DATA,
TEST_INDX)
RMAN> run
2> {
3> set until time "to_date('13-05-2010 17:27:20','dd-mm-yyyy hh24:mi:ss')";
4> DUPLICATE TARGET DATABASE TO CLONEDB SKIP TABLESPACE TEST_DATA, TEST_INDX;
9
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
5> }
10
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
11
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
archived log for thread 1 with sequence 4 is already on disk as file D:\ORACLE\A
PP\FLASH_RECOVERY_AREA\CHE\ARCHIVELOG\2010_05_13\O1_MF_1_4_5YQSLM4W_.ARC
archived log for thread 1 with sequence 5 is already on disk as file D:\ORACLE\A
PP\FLASH_RECOVERY_AREA\CHE\ARCHIVELOG\2010_05_13\O1_MF_1_5_5YQTW4H4_.ARC
archived log file name=D:\ORACLE\APP\FLASH_RECOVERY_AREA\CHE\ARCHIVELOG\2010_05_
13\O1_MF_1_4_5YQSLM4W_.ARC thread=1 sequence=4
archived log file name=D:\ORACLE\APP\FLASH_RECOVERY_AREA\CHE\ARCHIVELOG\2010_05_
13\O1_MF_1_5_5YQTW4H4_.ARC thread=1 sequence=5
media recovery complete, elapsed time: 00:00:04
Finished recover at 13-MAY-10
12
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
13
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
14
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
INSTANCE_NAME HOST_NAME
---------------- --------------------
clonedb ARULMOZHIVARMA
11. Export the table from CLONEDB & import into CHE database.
D:\>set oracle_sid=clonedb
Username: raja/raja
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table OBJECTS 69261 rows exported
Export terminated successfully without warnings.
15
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
D:\>set oracle_sid=che
Username: raja/raja
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export file created by EXPORT:V11.01.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing RAJA's objects into RAJA
. . importing table "OBJECTS" 69261 rows imported
Import terminated successfully without warnings.
INSTANCE_NAME HOST_NAME
---------------- -----------------------------------------------------------
che ARULMOZHIVARMA
A user dropped a table accidentally. At least we know anyone time/sequence/SCN, & easily
recovered the table.
W e don’t know the exact time that table was dropped. How can we find?
U just refresh about LOGMINER utility ☺
Using LOGMINER to analyze the online redo log files or archived log files & find the SCN.
16
Accidentally dropped table: Recovery using RMAN cloning
http://dbarajabaskar.blogspot.com/
RMAN> run
2> {
3> set until scn scnnumber;
4> DUPLICATE TARGET DATABASE TO CLONEDB SKIP TABLESPACE TEST_DATA, TEST_INDX;
5> }
Best Regards
RajaBaskar Thangaraj
www.dbarajabaskar.blogspot.com
Mail me: rajabaskar.t@gmail.com
17