NBN脚本改RMAN备份

以下为NBN脚本改RMAN备份的脚本,环境会有些影响变化。

1. #        echo "Default - Full backup requested" >> $RMAN_LOG_FILE
2. #        BACKUP_TYPE="INCREMENTAL LEVEL=0"
3. fi
4. 
5. echo "BACKUP_TYPE">> $RMAN_LOG_FILE
6. echo ${BACKUP_TYPE} >> $RMAN_LOG_FILE
7. # ---------------------------------------------------------------------------
8. # Call Recovery Manager to initiate the backup. This example does not use a
9. # Recovery Catalog. If you choose to use one, replace the option 'nocatalog'
10. # from the rman command line below with the 
11. # 'catalog <userid>/<passwd>@<net service name>' statement.
12. #
13. # Note: Any environment variables needed at run time by RMAN 
14. #       must be set and exported within the switch user (su) command.
15. # ---------------------------------------------------------------------------
16. #  Backs up the whole database.  This backup is part of the incremental
17. #  strategy (this means it can have incremental backups of levels > 0
18. #  applied to it).
19. #
20. #  We do not need to explicitly request the control file to be included
21. #  in this backup, as it is automatically included each time file 1 of
22. #  the system tablespace is backed up (the inference: as it is a whole
23. #  database backup, file 1 of the system tablespace will be backed up,
24. #  hence the controlfile will also be included automatically).
25. #
26. #  Typically, a level 0 backup would be done at least once a week.
27. #
28. #  The scenario assumes:
29. #     o you are backing your database up to two tape drives
30. #     o you want each backup set to include a maximum of 5 files
31. #     o you wish to include offline datafiles, and read-only tablespaces,
32. #       in the backup
33. #     o you want the backup to continue if any files are inaccessible.
34. #     o you are not using a Recovery Catalog
35. #     o you are explicitly backing up the control file.  Since you are
36. #       specifying nocatalog, the controlfile backup that occurs
37. #       automatically as the result of backing up the system file is
38. #       not sufficient; it will not contain records for the backup that
39. #       is currently in progress.
40. #     o you want to archive the current log, back up all the
41. #       archive logs using two channels, putting a maximum of 20 logs
42. #       in a backup set, and deleting them once the backup is complete.
43. #
44. #  Note that the format string is constructed to guarantee uniqueness and
45. #  to enhance NetBackup for Oracle backup and restore performance.
46. #
47. #
48. #  NOTE WHEN USING NET SERVICE NAME: When connecting to a database
49. #  using a net service name, you must use a send command or a parms operand to 
50. #  specify environment variables.  In other words, when accessing a database
51. #  through a listener, the environment variables set at the system level are not 
52. #  visible when RMAN is running.  For more information on the environment
53. #  variables, please refer to the NetBackup for Oracle Admin. Guide. oracle ocm
54. #
55. # ---------------------------------------------------------------------------
56. 
57. ORACLE_HOME=$ORACLE_HOME
58. export ORACLE_HOME
59. ORACLE_SID=$ORACLE_SID
60. export ORACLE_SID
61. $RMAN target $TARGET_CONNECT_STR nocatalog msglog $RMAN_LOG_FILE append << EOF
62. RUN {
63. ALLOCATE CHANNEL ch00 TYPE DISK;
64. ALLOCATE CHANNEL ch01 TYPE DISK;
65. # crosscheck archivelog 
66. CROSSCHECK ARCHIVELOG ALL;
67. # crosscheck backup image
68. CROSSCHECK BACKUP;
69. #DELETE OBSOLETE BACKUP IMAGE
70. DELETE NOPROMPT OBSOLETE;
71. #DELETE EXPIRED BACKUP IMAGE
72. DELETE NOPROMPT EXPIRED BACKUP; 
73. BACKUP
74.     $BACKUP_TYPE
75.     SKIP INACCESSIBLE
76.     TAG hot_db_bk_level0
77.     FILESPERSET 2
78.     # recommended format
79.     FORMAT '${RMAN_IMAGE_DIR}/bk_%s_%p_%t'
80.     DATABASE;
81.     sql 'alter system archive log current';
82. RELEASE CHANNEL ch00;
83. RELEASE CHANNEL ch01;
84. # backup all archive logs
85. ALLOCATE CHANNEL ch00 TYPE DISK;
86. ALLOCATE CHANNEL ch01 TYPE DISK;
87. BACKUP
88.    filesperset 20
89.    FORMAT '${RMAN_IMAGE_DIR}/al_%s_%p_%t'
90.    ARCHIVELOG ALL DELETE INPUT;
91. RELEASE CHANNEL ch00;
92. RELEASE CHANNEL ch01;
93. #
94. # Note: During the process of backing up the database, RMAN also backs up the
95. # control file.  This version of the control file does not contain the
96. # information about the current backup because "nocatalog" has been specified.
97. # To include the information about the current backup, the control file should
98. # be backed up as the last step of the RMAN section.  This step would not be
99. # necessary if we were using a recovery catalog or auto control file backups.
100. #
101. ALLOCATE CHANNEL ch00 TYPE DISK;
102. BACKUP
103.     # recommended format
104.     FORMAT '${RMAN_IMAGE_DIR}/cntrl_%s_%p_%t'
105.     CURRENT CONTROLFILE;
106. RELEASE CHANNEL ch00;
107. }
108. exit
109. EOF

 

你可能感兴趣的:(rman,requested,NBN,北京oracle培训)