Search This Blog

Total Pageviews

Monday 4 July 2011

Oracle RMAN backup script

RMAN Script



RMAN> CREATE GLOBAL SCRIPT full_backup FROM FILE 'full_backup.txt';

starting full resync of recovery catalog
full resync complete
script commands will be loaded from file full_backup.txt
created global script full_backup



RMAN> PRINT GLOBAL SCRIPT full_backup;

printing stored global script: full_backup
CREATE GLOBAL SCRIPT full_backup
{
BACKUP DATABASE PLUS ARCHIVELOG;
DELETE FORCE NOPROMPT OBSOLETE;
}



RMAN> LIST GLOBAL SCRIPT NAMES;

List of Stored Scripts in Recovery Catalog


Global Scripts


Script Name
Description
-----------------------------------------------------------------------
full_backup


RMAN> LIST ALL SCRIPT NAMES; # Global and local scripts.


List of Stored Scripts in Recovery Catalog


Global Scripts


Script Name
Description
-----------------------------------------------------------------------
full_backup





REPLACE GLOBAL SCRIPT full_backup
{
BACKUP DATABASE PLUS ARCHIVELOG;
DELETE FORCE NOPROMPT OBSOLETE;
}

REPLACE GLOBAL SCRIPT full_backup FROM FILE 'full_backup.txt';

DELETE GLOBAL SCRIPT 'full_backup';


--------------------------

in full_backup.txt

REPLACE GLOBAL SCRIPT full_backup
{
BACKUP DATABASE PLUS ARCHIVELOG;
DELETE FORCE NOPROMPT OBSOLETE;
}



RMAN> REPLACE GLOBAL SCRIPT full_backup FROM FILE 'full_backup.txt';

script commands will be loaded from file full_backup.txt
replaced global script full_backup




RMAN> RUN { EXECUTE GLOBAL SCRIPT full_backup; }

executing global script: full_backup

replaced global script full_backup




RMAN> RESTORE DATABASE PREVIEW SUMMARY;

Starting restore at 04-JUL-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=49 device type=DISK

datafile 10 will be created automatically during restore operation

List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
403 B F A DISK 30-JUN-11 1 1 NO TAG20110630T154709
using channel ORA_DISK_1

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key Thrd Seq S Low Time
------- ---- ------- - ---------
401 1 503 A 30-JUN-11
Name: /opt/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_03/o1_mf_1_503_7105ld5k_.arc

Media recovery start SCN is 11182696
Recovery must be done beyond SCN 11488234 to clear datafile fuzziness
Finished restore at 04-JUL-11


RMAN> RESTORE TABLESPACE users PREVIEW SUMMARY;

Starting restore at 04-JUL-11
using channel ORA_DISK_1


List of Backups
===============
Key TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
403 B F A DISK 30-JUN-11 1 1 NO TAG20110630T154709

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key Thrd Seq S Low Time
------- ---- ------- - ---------
401 1 503 A 30-JUN-11
Name: /opt/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_03/o1_mf_1_503_7105ld5k_.arc

Media recovery start SCN is 11182696
Recovery must be done beyond SCN 11182696 to clear datafile fuzziness
Finished restore at 04-JUL-11







RMAN> RESTORE DATABASE PREVIEW;

Starting restore at 04-JUL-11
using channel ORA_DISK_1

datafile 10 will be created automatically during restore operation

List of Backup Sets
===================


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
403 Full 1.62G DISK 00:03:09 30-JUN-11
BP Key: 407 Status: AVAILABLE Compressed: NO Tag: TAG20110630T154709
Piece Name: /home/oracle/RMAN/full_0fmg6kvu_1_1.bak
List of Datafiles in backup set 403
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/system01.dbf
2 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/sysaux01.dbf
3 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/undotbs01.dbf
4 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/users01.dbf
5 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/example01.dbf
6 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/anujtest.dbf
7 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/tsapexf01.dbf
8 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/tsapexu01.dbf
9 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/test.dbf

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key Thrd Seq S Low Time
------- ---- ------- - ---------
401 1 503 A 30-JUN-11
Name: /opt/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_03/o1_mf_1_503_7105ld5k_.arc

Media recovery start SCN is 11182696
Recovery must be done beyond SCN 11488234 to clear datafile fuzziness
Finished restore at 04-JUL-11

RMAN> RESTORE TABLESPACE users PREVIEW;

Starting restore at 04-JUL-11
using channel ORA_DISK_1


List of Backup Sets
===================


BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
403 Full 1.62G DISK 00:03:09 30-JUN-11
BP Key: 407 Status: AVAILABLE Compressed: NO Tag: TAG20110630T154709
Piece Name: /home/oracle/RMAN/full_0fmg6kvu_1_1.bak
List of Datafiles in backup set 403
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
4 Full 11182696 30-JUN-11 /opt/app/oracle/oradata/orcl/users01.dbf

List of Archived Log Copies for database with db_unique_name ORCL
=====================================================================

Key Thrd Seq S Low Time
------- ---- ------- - ---------
401 1 503 A 30-JUN-11
Name: /opt/app/oracle/flash_recovery_area/ORCL/archivelog/2011_07_03/o1_mf_1_503_7105ld5k_.arc

Media recovery start SCN is 11182696
Recovery must be done beyond SCN 11182696 to clear datafile fuzziness
Finished restore at 04-JUL-11

No comments:

Oracle DBA

anuj blog Archive