Recovery scenarios through rman

881 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
881
On SlideShare
0
From Embeds
0
Number of Embeds
45
Actions
Shares
0
Downloads
88
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Recovery scenarios through rman

  1. 1. Anar Godjaev http://anargodjaev.wordpress.com/ Recovery Scenarios through RMAN Complete Recovery when SYSTEM tablespace is missing. Problem Generation Delete system tablespacedatafile from operating system when database is up and running. [oracle@anaranardb]$ rm -i /u01/app/oracle/oradata/disk3/anardb/system01.dbf Solution i. [oracle@anaranardb]$sqlplus / as sysdba ii. SQL> SHUTDOWN abort; iii. SQL> STARTUP mount; iv. SQL> SELECT file#, name FROM v$datafile; v. Using rman connect to target database and catalog database or directly to target database. [oracle@oem scripts]$ rman target sys/oracle@anardb catalog rman/rman@oemdb vi. RMAN> run { restoredatafile 1; recoverdatafile 1; sql ‘ alter database open ‘; } Complete Recovery when NON-SYSTEM tablespace is missing and database is open and restoring datafileto different location. Problem Generation i. Delete USERS tablespacedatafile from operating system [oracle@anaranardb]$ rm -i users01.dbf ii. Connect as user sh/sh and create a table in userstablespace SQL> CREATE TABLE sales_test TABLESPACE users AS
  2. 2. Anar Godjaev http://anargodjaev.wordpress.com/ SELECT * FROM sales WHERE ROWNUM < 10; ERROR at line 3: ORA-01116: error in opening database file 4 ORA-01110: data file 4: ‘/u01/app/oracle/oradata/disk3/anardb/users01.dbf’ ORA-27041: unable to open file Linux Error: 2: No such file or directory Additional information: 3 Solution i. As DBA user make datafile users01.dbf off line SQL> SELECT file#, name FROM v$datafile; SQL> ALTER DATABASE DATAFILE 4 OFFLINE; ii. Restoring and recovering datafile 4 at new location RMAN> run { setnewname for datafile 4 to ‘/u01/app/oracle/oradata/disk5/anardb/users01.dbf’; restoredatafile 4; switchdatafile 4; recoverdatafile 4; sql ‘ alter database datafile 4 online’; } iii. Connect as user sh/sh and create a table in userstablespace SQL> CREATE TABLE sales_test TABLESPACE users
  3. 3. Anar Godjaev http://anargodjaev.wordpress.com/ AS SELECT * FROM sales WHERE ROWNUM < 10; Table created. Complete Recovery when NON-SYSTEM tablespace is missing and database is closed and restoring datafileto different location. Problem Generation i. Shutdown the database. SQL> SHUTDOWN immediate; ii. Delete USERS tablespacedatafile from operating system [oracle@anaranardb]$ rm -i users01.dbf iii. Start the database SQL> STARTUP; ORACLE instance started. Total System Global Area 536870912 bytes Fixed Size 1220460 bytes Variable Size 213909652 bytes Database Buffers 318767104 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file ORA-01110: data file 4: ‘/u01/app/oracle/oradata/disk5/anardb/users01.dbf’ Solution i. Make datafile 4 offline SQL> ALTER DATABASE DATAFILE 4 OFFLINE;
  4. 4. Anar Godjaev http://anargodjaev.wordpress.com/ ii. Open the database with datafile 4 oflfine SQL> ALTER DATABASE OPEN; iii. Using RMAN again connect to target database [oracle@oem scripts]$ rman target sys/oracle@anardb catalog rman/rman@oemdb iv. Restoring and recovering datafile 4 at new location RMAN> run { setnewname for datafile 4 to ‘/u01/app/oracle/oradata/disk3/anardb/users01.dbf’; restoredatafile 4; switchdatafile 4; recoverdatafile 4; sql ‘ alter database datafile 4 online’; }

×