RMAN Backup Shell Script Example (Doc ID 137181.1)
RMAN Backup Shell Script Example (Doc ID 137181.1)
Abstract |
|
RMAN Backup Shell Script Example |
|
|
|
Product Name, Product Version |
RMAN, 08.01.XX to 09.02.XX |
Platform |
Platform Independent |
Date Created |
31-Dec-2002 |
|
|
Instructions |
|
Checked for relevance on 24-MAR-2012.
Execution Environment:
Execution Environment:
1) Create a catalog database (rmancat) if one does not exist (With additional
RBS-, USERS- and TEMP-tablespaces)
2) Configure SQL*Net to handle the catalog (rmancat) and the
3) Create a user 'RMAN' in the catalog database.
4) Create the RMAN-catalog in the catalog database.
5) Register the target-database with catalog: Access Privileges:
User that is member of dba group.
Permission to write to directory where backups will be stored when doing
backup to disk.
Usage:
backup_database
Ex: Instructions:
1) Verify that catalog is running and you can connect as rman via sqlnet.
% sqlplus rman/rman@rmancat 2) Using the information to connect to catalog via sqlplus, set following parameters in script.
rman_id=rman # RMAN userid 3) Determine which instance to backup (target). The target instance to backup must be listed in the following file
For Solaris
For AIX, DG, HP, Linux, Sequent, SGI, Tru64 4) Determine target instance nls setting for nls_lang parameter.
SQL> select value from v$nls_parameters where parameter = 'NLS_LANGUAGE'; 5) Use above nls information to edit script to change charset parameter. charset="LANGUAGE_TERRITORY.CHARACTERSET" # Characterset of the database
6) Determine if backup will be to disk or tape. % $ORACLE_HOME/bin/sbttest test 7) Run script
NOTE: If instance is not mounted or open when running script it will only backup datafiles and not backup PROOFREAD THIS SCRIPT BEFORE USING IT! Due to differences in the way text
editors, e-mail packages, and operating systems handle text formatting (spaces,
tabs, and carriage returns), this script may not be in an executable state
when you first receive it. Check over the script to ensure that errors of
this type are corrected.The script will produce an output file named [outputfile].
This file can be viewed in a browser or uploaded for support analysis.
|
|
|
|
Description |
|
This script takes input of target instance sid to backup and device type to backup to. It takes the target instance sid and sets the environment using the Oracle supplied "oraenv" script. It then checks the status of the instance to see what mount condition it is in and if running in mount or open mode checks to see if it is running in archivelog mode and what log sequence it is at.
With this is information it creates a rman backup command file "/tmp/
%d = Database name
Once the command file is created then rman utility is launched with syntax of "rman cmdfile=$outputfile msglog=$logfile" where $outputfile is the command file "/tmp/
Check the file "/tmp/rman_
RMAN-00571: =========================================================== |
|
|
|
References |
|
Oracle8i Recovery Manager User's Guide and Reference
Note:76736.1 : "RMAN FAQ: Recovery Manager -- Frequently Asked Questions"
Note:164521.1 : "NLS Setting Using RMAN"
Note:121112.1 : "Setting Default Location of RMAN Snapshot Control File"
|
|
|
|
Script |
|
#! /bin/sh # User defined parameters
charset="AMERICAN_AMERICA.WE8ISO8859P15" # Characterset of the database
# if [ -z "$1" -o -z "$2" ]; then
echo ""
sid=$1 # Source database
# outputfile=/tmp/$$$sid.bck
#
#
#
#
if [ "$pmon" = "" ]; then
if [ $db_status = "MOUNTED" -o $db_status = "OPEN" ]; then
#
if [ "$log_seq" = "" ]; then fi
#
#
#
echo "" >> $outputfile
#
#
#
#
echo "" >> $outputfile
#
echo " filesperset=4" >> $outputfile
#
if [ $archive_log = "ARCHIVELOG" ]; then
if [ $backup_type = "tape" ]; then
echo " release channel ch1;" >> $outputfile
#
#
echo "" >> $outputfile echo "}" >> $outputfile
#
echo "" rm $outputfile |
|
|
|
|
|
Disclaimer |
|
EXCEPT WHERE EXPRESSLY PROVIDED OTHERWISE, THE INFORMATION, SOFTWARE,
PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS. ORACLE EXPRESSLY DISCLAIMS
ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NON-INFRINGEMENT. ORACLE MAKES NO WARRANTY THAT: (A) THE RESULTS
THAT MAY BE OBTAINED FROM THE USE OF THE SOFTWARE WILL BE ACCURATE OR
RELIABLE; OR (B) THE INFORMATION, OR OTHER MATERIAL OBTAINED WILL MEET YOUR
EXPECTATIONS. ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE DOWNLOADED OR
OTHERWISE OBTAINED IS DONE AT YOUR OWN DISCRETION AND RISK. ORACLE SHALL HAVE
NO RESPONSIBILITY FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT
RESULTS FROM THE DOWNLOAD OF ANY CONTENT, MATERIALS, INFORMATION OR SOFTWARE.
ORACLE RESERVES THE RIGHT TO MAKE CHANGES OR UPDATES TO THE SOFTWARE AT ANY
TIME WITHOUT NOTICE.
|
|
|
|
Limitation of Liability |
|
IN NO EVENT SHALL ORACLE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL OR CONSEQUENTIAL DAMAGES, OR DAMAGES FOR LOSS OF PROFITS, REVENUE,
DATA OR USE, INCURRED BY YOU OR ANY THIRD PARTY, WHETHER IN AN ACTION IN
CONTRACT OR TORT, ARISING FROM YOUR ACCESS TO, OR USE OF, THE SOFTWARE.
SOME JURISDICTIONS DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY.
ACCORDINGLY, SOME OF THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.
|
|
|
|
References
NOTE:121112.1 - Setting Default Location of RMAN Snapshot Control File
NOTE:137181.1 - RMAN Backup Shell Script Example
NOTE:164521.1 - NLS Setting Using RMAN
NOTE:76736.1 - RMAN FAQ: Recovery Manager -- Frequently Asked Questions
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1160643/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN -- Frequently Asked Question (FAQ) (Doc ID 469777.1)
- Shell Script
- shell script
- Oracle 最新PSU (Doc ID 2118136.2)Oracle
- Using V$BACKUP_ASYNC_IO / V$BACKUP_SYNC_IO to Monitor RMAN PerformanceORM
- expdp/impdp變慢 (Doc ID 2469587.1)
- Reading and Understanding Systemstate Dumps (Doc ID 423153.1)
- shell script的簡單使用
- 理解RMAN backup database plus archivelog delete all input命令DatabaseHivedelete
- Oracle 下載最新psu (Doc ID 2118136.2)Oracle
- RMAN-03009: failure of backup command on ORA_DISK_1 channelAI
- PRCT-1011 : Failed to run "oifcfg" (Doc ID 1380183.1)AI
- How to Collect Diagnostics for Database Hanging Issues (Doc ID 452358.1)Database
- [轉帖]Release Schedule of Current Database Releases (Doc ID 742060.1)Database
- 【CURSOR】How to Monitor and tune Open and Cached Cursors (Doc ID 1430255.1)
- Physical Standby Switchover_status Showing Not Allowed. (Doc ID 1392763.1)
- oracle11g: Scheduler Maintenance Tasks or Autotasks (Doc ID 756734.1)OracleAINaN
- 【DBA】Relinking Oracle Home 常見問題 (Doc ID 2048232.1)Oracle
- How To Replicate Data from Oracle to Postgres Using GoldenGate (Doc ID 1544137.1OracleGo
- 11g-Reduce Transportable Tablespace Downtime using XTTS (Doc ID 1389592.1)TTS
- shell script程式設計小結——附帶例項程式設計
- Can GoldenGate Replicate An Oracle Table That Contains Only CLOB Column(s)? (Doc ID 971833.1)GoOracleAI
- 12c DG新特性 - Active Data Guard Far Sync (Doc ID 2179719.1)
- 【GRID】Grid Infrastructure 啟動的五大問題 (Doc ID 1526147.1)ASTStruct
- 【DATAGUARD】Data Guard 12C 新特性:Far Sync Standby (Doc ID 2179719.1)
- SqlServer 備份集和備份片以及mirror的backup_set_idSQLServer
- RMAN restore fails with ORA-01180: can not create datafile 1 (文件 ID 1265151.1)RESTAI
- ORA-04063: package body SYS.DBMS_REGISTRY_SYS has errors (Doc ID 2165402.1)PackageError
- 【ASM】ORA-27504 ORA-27300 ORA-27303 while starting ASM (Doc ID 2281441.1)ASMWhile
- 【RAC】Oracle 12c以及以上版本的diagsnap是什麼? (Doc ID 2469643.1)Oracle
- 4.5.1.3.2 Example
- [20201112]centos 7 rc.local shell script on systemd while booting Linux system.tCentOSWhilebootLinux
- An example of polybase for OracleOracle
- simd example code
- SQLBackupAndFTP12.0 failed to backup database with full backup typeSQLFTPAIDatabase
- 請說說`<script>`、`<script async>`和`<script defer>`的區別
- Script
- 使用Shell指令碼查詢程式對應的程式ID指令碼
- sqlserver docSQLServer