RMAN中SET命令的常見用法的小結 (ZT)
-------------------------------------------
*** set command***
-------------------------------------------
[b]使用set命令可以定義只應用於當前RMAN會話的設定,
它於configure命令非常相似,但它設定的值不是永久的
可以用兩種方法使用set命令:在run的塊內和塊外[/b]
-----------------------------------------------------------------
[color=Blue][b]--set 位於 run 塊外[/b][/color]
------------------------
1. set echo ON|OFF;
2. set DBID=1234566789;
3. set controlfile autobackup format for device type [disk|stb] to 'd:control.bak';
-------------------------------------------------------------------
[color=Blue][b]--set 位於 run 塊內[/b][/color]
------------------------
1. set newname datafile 1 to 'E:oracleoradatasystem01.dbf';
--在執行TSPITR or 移動Datafile的位置時用
2. set maxcorrupt for datafile 1,2,3,7 to 10;
--在RMAN操作失敗前準許每個檔案有10次的錯誤
3. set archivelog destination to 'D: emp';
--設定archive_log_dest_1的目的地
4. set until time "TO_DATE('09/20/00','MM/DD/YY')"|'sysdate-2';
--基於時間的設定可用於恢復時
set until scn 1000
--基於scn的設定可用於恢復時
SET UNTIL SEQUENCE 1234 THREAD 1;
--基於sequence和thread的設定,常用於恢復時
5. set backup copies 2;
--設定一個backup file有兩份相同內容的檔案
6. set command id 'rman';
7. set controlfile autobackup format for device type [disk|stb] to 'd:control.bak';
--設定control file的auto backup
-------------------------------------------------------------------------------------
[color=Blue]for example:[/color]-
---------------------------------------
1.
Restoring the Control File When Databases Share the Same Name: Example The
following shell script uses the DBID to restore the control file because multiple
target databases share the same DB_NAME in the catalog. After you have restored the
target control file, you can mount the database to restore the rest of the database:
#!/usr/bin/tcsh
rman TARGET / CATALOG rman/rman@catdb < STARTUP FORCE NOMOUNT;
SET DBID = 862893450; # needed to distinguish target from others with same DB_NAME
RESTORE CONTROLFILE; # assuming catalog has automatic channel allocation information
ALTER DATABASE MOUNT;
EOF
2.
Setting the Command ID: Example This example sets the command ID, backs up
the users tablespace, then archives the online redo logs:
RUN
{
ALLOCATE CHANNEL t1 DEVICE TYPE DISK FORMAT '/disk1/%U';
ALLOCATE CHANNEL t2 DEVICE TYPE DISK FORMAT '/disk2/%U';
SET COMMAND ID TO 'rman';
BACKUP INCREMENTAL LEVEL 0 FILESPERSET 5 TABLESPACE users;
SQL 'ALTER SYSTEM ARCHIVE LOG ALL';
}
3.
Duplexing a Backup Set: Example Assume that you have used the CONFIGURE
command to set duplexing as follows:
CONFIGURE ARCHIVELOG COPIES FOR DEVICE TYPE sbt TO 4;
CONFIGURE DATAFILE COPIES FOR DEVICE TYPE sbt TO 3;
4.
The following example overrides these configurations and makes two copies of
each datafile and archived log in the backup:
RUN
{
ALLOCATE CHANNEL dev1 DEVICE TYPE sbt;
SET BACKUP COPIES = 2;
BACKUP FILESPERSET 1 DATAFILE 1,2,3,4,5;
BACKUP FILESPERSET 10 ARCHIVELOG ALL;
}
5.
Overriding the Autobackup Format During a Restore: Example This example sets
the DBID, sets a boundary time for the restore, then restores a control file
autobackup with a nondefault format. First start RMAN and then run:
CONNECT TARGET / NOCATALOG
STARTUP FORCE NOMOUNT
SET DBID 676549873;
RUN
{
SET UNTIL TIME '10/10/2001 13:45:00';
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/cf_%F.bak';
RESTORE CONTROLFILE FROM AUTOBACKUP MAXSEQ 100;
}
6.
Restoring the Server Parameter File: Example This example restores a lost server parameter file:
CONNECT TARGET / CATALOG rman/rman@catdb
SET DBID 676549873; # set dbid so rman knows the database name
STARTUP FORCE NOMOUNT # rman starts database with a dummy server parameter file
RESTORE SPFILE;
STARTUP FORCE; # needed so that RMAN restarts database with restored server parameter file
*** set command***
-------------------------------------------
[b]使用set命令可以定義只應用於當前RMAN會話的設定,
它於configure命令非常相似,但它設定的值不是永久的
可以用兩種方法使用set命令:在run的塊內和塊外[/b]
-----------------------------------------------------------------
[color=Blue][b]--set 位於 run 塊外[/b][/color]
------------------------
1. set echo ON|OFF;
2. set DBID=1234566789;
3. set controlfile autobackup format for device type [disk|stb] to 'd:control.bak';
-------------------------------------------------------------------
[color=Blue][b]--set 位於 run 塊內[/b][/color]
------------------------
1. set newname datafile 1 to 'E:oracleoradatasystem01.dbf';
--在執行TSPITR or 移動Datafile的位置時用
2. set maxcorrupt for datafile 1,2,3,7 to 10;
--在RMAN操作失敗前準許每個檔案有10次的錯誤
3. set archivelog destination to 'D: emp';
--設定archive_log_dest_1的目的地
4. set until time "TO_DATE('09/20/00','MM/DD/YY')"|'sysdate-2';
--基於時間的設定可用於恢復時
set until scn 1000
--基於scn的設定可用於恢復時
SET UNTIL SEQUENCE 1234 THREAD 1;
--基於sequence和thread的設定,常用於恢復時
5. set backup copies 2;
--設定一個backup file有兩份相同內容的檔案
6. set command id 'rman';
7. set controlfile autobackup format for device type [disk|stb] to 'd:control.bak';
--設定control file的auto backup
-------------------------------------------------------------------------------------
[color=Blue]for example:[/color]-
---------------------------------------
1.
Restoring the Control File When Databases Share the Same Name: Example The
following shell script uses the DBID to restore the control file because multiple
target databases share the same DB_NAME in the catalog. After you have restored the
target control file, you can mount the database to restore the rest of the database:
#!/usr/bin/tcsh
rman TARGET / CATALOG rman/rman@catdb <
SET DBID = 862893450; # needed to distinguish target from others with same DB_NAME
RESTORE CONTROLFILE; # assuming catalog has automatic channel allocation information
ALTER DATABASE MOUNT;
EOF
2.
Setting the Command ID: Example This example sets the command ID, backs up
the users tablespace, then archives the online redo logs:
RUN
{
ALLOCATE CHANNEL t1 DEVICE TYPE DISK FORMAT '/disk1/%U';
ALLOCATE CHANNEL t2 DEVICE TYPE DISK FORMAT '/disk2/%U';
SET COMMAND ID TO 'rman';
BACKUP INCREMENTAL LEVEL 0 FILESPERSET 5 TABLESPACE users;
SQL 'ALTER SYSTEM ARCHIVE LOG ALL';
}
3.
Duplexing a Backup Set: Example Assume that you have used the CONFIGURE
command to set duplexing as follows:
CONFIGURE ARCHIVELOG COPIES FOR DEVICE TYPE sbt TO 4;
CONFIGURE DATAFILE COPIES FOR DEVICE TYPE sbt TO 3;
4.
The following example overrides these configurations and makes two copies of
each datafile and archived log in the backup:
RUN
{
ALLOCATE CHANNEL dev1 DEVICE TYPE sbt;
SET BACKUP COPIES = 2;
BACKUP FILESPERSET 1 DATAFILE 1,2,3,4,5;
BACKUP FILESPERSET 10 ARCHIVELOG ALL;
}
5.
Overriding the Autobackup Format During a Restore: Example This example sets
the DBID, sets a boundary time for the restore, then restores a control file
autobackup with a nondefault format. First start RMAN and then run:
CONNECT TARGET / NOCATALOG
STARTUP FORCE NOMOUNT
SET DBID 676549873;
RUN
{
SET UNTIL TIME '10/10/2001 13:45:00';
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '?/oradata/cf_%F.bak';
RESTORE CONTROLFILE FROM AUTOBACKUP MAXSEQ 100;
}
6.
Restoring the Server Parameter File: Example This example restores a lost server parameter file:
CONNECT TARGET / CATALOG rman/rman@catdb
SET DBID 676549873; # set dbid so rman knows the database name
STARTUP FORCE NOMOUNT # rman starts database with a dummy server parameter file
RESTORE SPFILE;
STARTUP FORCE; # needed so that RMAN restarts database with restored server parameter file
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-84798/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- nslookup命令的常見用法
- useradd 命令的常見用法
- C++ 指標常見用法小結C++指標
- RMAN說,我能備份(16)--RMAN中的SET命令
- Git SSH 命令常見用法Git
- echo命令在Unix中的作用以及其常見用法?
- rman set newname switch 用法
- RMAN命令小結(精簡命令)
- Linux命令列:cURL的十種常見用法Linux命令列
- 【Python】執行系統命令的常見用法Python
- ORACLE表連線方式分析及常見用法(zt)Oracle
- RMAN : set newname for命令的一點研究
- 在node中的mongodb及mongoose常見用法MongoDB
- Python中set的用法Python
- shell中set指令的用法
- 常見Oracle HINT的用法Oracle
- javascript中的資料型別及其常見用法JavaScript資料型別
- 理解 shell 指令碼中的常見用法: 2>&1指令碼
- AOSP常見的命令
- 常見的DOS命令
- 常見的錯誤 SQL 用法SQL
- urllib庫的常見用法
- Rman 中的delete input的用法delete
- tkprof命令列工具用法小結命令列
- shell入門基礎&常見命令及用法
- C#中Finally的一個不太常見的用法C#
- Linux中find常見用法示例Linux
- SQL Server中row_number函式的常見用法SQLServer函式
- Linux常見操作小結Linux
- 幾個常見函式的非常見用法函式
- 常見的linux命令Linux
- 命令列中常見命令用法及explainshell.com的用法命令列AI
- STL:set用法總結
- 【轉】 C#中Finally的一個不太常見的用法C#
- SQLNET.ORA 的常見用法SQL
- 類别範本的常見用法
- [zt] RMAN的原理
- sqlldr的用法小結SQL