"TRANSPORT TABLESPACE" --从备份中为一或多个表空间创建可传输表空间
Creates transportable tablespace sets from backup for one or more tablespaces.
Examples
Creating Transporable Tablespaces from Backup with TRANSPORT TABLESPACE: Example
In this example, the tablespaces for the transportable set are tbs_2 and tbs_3, the transportable set files are to be stored at /disk1/transport_dest, and the transportable tablespaces are to be recovered to the present time:
transport tablespace tbs_2, tbs_3
tablespace destination '/disk1/transportdest'
auxiliary destination '/disk1/auxdest'
;
Using TRANSPORT TABLESPACE with a Past Point in Time: Example
In this example, the tablespaces for the transportable set are tbs_2 and tbs_3, the transportable set files are to be stored at /disk1/transport_dest, and the transportable tablespaces are to be recovered to a specific SCN:
transport tablespace tbs_2, tbs_3
tablespace destination '/disk1/transportdest'
auxiliary destination '/disk1/auxdest'
UNTIL SCN 251982;
;
Using TRANSPORT TABLESPACE with Custom File Locations: Example
This example illustrates the use of the optional arguments of TRANSPORT TABLESPACE that control the locations of the Data Pump-related files such as the dump file, as well as the DATAPUMP DIRECTORY which in this case references a directory object mypumpdir:
TRANSPORT TABLESPACE tbs_2
TABLESPACE DESTINATION '/disk1/transportdest'
AUXILIARY DESTINATION '/disk1/auxdest'
DATAPUMP DIRECTORY mypumpdir
DUMP FILE 'mydumpfile.dmp'
IMPORT SCRIPT. 'myimportscript.sql'
EXPORT LOG 'myexportlog.log';
--unregister ,就是从rman catalog不再管理目标库
Example
Unregistering a Database: Example
In this example, you connect to the target database test1 and then unregister it:
rman TARGET SYS/oracle@test1 CATALOG rman/rman@catdb
RMAN> UNREGISTER DATABASE NOPROMPT;
Unregistering a Database That is Not Unique in Catalog: Example
The following UNIX shell script. unregisters database testdb from the recovery catalog. Because multiple databases called testdb are registered in the recovery catalog, and because RMAN is not connected to the target database (which has already been deleted from the file system), you must run SET DBID:
rman CATALOG rman/rman@catdb
RMAN> RUN
{
SET DBID 1334531173; # specifies test database by DBID
UNREGISTER DATABASE testdb NOPROMPT;
}
--set until sequence|time|scn|restore point
Examples
Performing Incomplete Recovery Until a Log Sequence Number: Example
This example assumes that log sequence 1234 was lost due to a disk failure and the database needs to be recovered by using available archived redo logs.
RUN
{
SET UNTIL SEQUENCE 1234 THREAD 1;
RESTORE CONTROLFILE ;
ALTER DATABASE MOUNT;
RESTORE DATABASE;
RECOVER DATABASE; # recovers through log 1233
ALTER DATABASE OPEN RESETLOGS;
}
Performing Incomplete Recovery to a Specified SCN: Example
This example (which assumes a mounted database) recovers the database until a specified SCN:
RUN
{
ALLOCATE CHANNEL ch1 TYPE sbt;
RESTORE DATABASE;
RECOVER DATABASE UNTIL SCN 1000; # recovers through SCN 999
ALTER DATABASE OPEN RESETLOGS;
}
Performing Incomplete Recovery to a Restore Point: Example
This example (which assumes that the database starts out not mounted) recovers the database until a specified restore point:
STARTUP MOUNT;
RUN
{
SET UNTIL RESTORE POINT 'before_batch';
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;
}
Reporting Obsolete Backups: Example
This example assumes that you want to be able to recover to any point within the last week. It considers as obsolete all backups that could be used to recover the database to a point one week ago:
REPORT OBSOLETE UNTIL TIME 'SYSDATE-7';
"UPGRADE CATALOG"
Upgrade the recovery catalog schema from an older version to the version required by the RMAN executable.
Note that UPGRADE CATALOG does not run scripts to perform. the upgrade. Instead, RMAN sends various SQL DDL statements to the recovery catalog to update the recovery catalog schema with new tables, views, columns, and so forth.
Upgrading a Recovery Catalog: Example
This example connects to recovery catalog database recdb at the operating system command line and then upgrades it to a more current version:
% rman CATALOG rcat/rcat@recdb
connected to recovery catalog database
PL/SQL package rcat.DBMS_RCVCAT version 08.00.04 in RCVCAT database is too old
RMAN> UPGRADE CATALOG
recovery catalog owner is rcat
enter UPGRADE CATALOG command again to confirm catalog upgrade
RMAN> UPGRADE CATALOG
recovery catalog upgraded to version 09.00.01
DBMS_RCVMAN package upgraded to version 09.00.01
DBMS_RCVCAT package upgraded to version 09.00.01
Creates transportable tablespace sets from backup for one or more tablespaces.
Examples
Creating Transporable Tablespaces from Backup with TRANSPORT TABLESPACE: Example
In this example, the tablespaces for the transportable set are tbs_2 and tbs_3, the transportable set files are to be stored at /disk1/transport_dest, and the transportable tablespaces are to be recovered to the present time:
transport tablespace tbs_2, tbs_3
tablespace destination '/disk1/transportdest'
auxiliary destination '/disk1/auxdest'
;
Using TRANSPORT TABLESPACE with a Past Point in Time: Example
In this example, the tablespaces for the transportable set are tbs_2 and tbs_3, the transportable set files are to be stored at /disk1/transport_dest, and the transportable tablespaces are to be recovered to a specific SCN:
transport tablespace tbs_2, tbs_3
tablespace destination '/disk1/transportdest'
auxiliary destination '/disk1/auxdest'
UNTIL SCN 251982;
;
Using TRANSPORT TABLESPACE with Custom File Locations: Example
This example illustrates the use of the optional arguments of TRANSPORT TABLESPACE that control the locations of the Data Pump-related files such as the dump file, as well as the DATAPUMP DIRECTORY which in this case references a directory object mypumpdir:
TRANSPORT TABLESPACE tbs_2
TABLESPACE DESTINATION '/disk1/transportdest'
AUXILIARY DESTINATION '/disk1/auxdest'
DATAPUMP DIRECTORY mypumpdir
DUMP FILE 'mydumpfile.dmp'
IMPORT SCRIPT. 'myimportscript.sql'
EXPORT LOG 'myexportlog.log';
--unregister ,就是从rman catalog不再管理目标库
Example
Unregistering a Database: Example
In this example, you connect to the target database test1 and then unregister it:
rman TARGET SYS/oracle@test1 CATALOG rman/rman@catdb
RMAN> UNREGISTER DATABASE NOPROMPT;
Unregistering a Database That is Not Unique in Catalog: Example
The following UNIX shell script. unregisters database testdb from the recovery catalog. Because multiple databases called testdb are registered in the recovery catalog, and because RMAN is not connected to the target database (which has already been deleted from the file system), you must run SET DBID:
rman CATALOG rman/rman@catdb
RMAN> RUN
{
SET DBID 1334531173; # specifies test database by DBID
UNREGISTER DATABASE testdb NOPROMPT;
}
--set until sequence|time|scn|restore point
Examples
Performing Incomplete Recovery Until a Log Sequence Number: Example
This example assumes that log sequence 1234 was lost due to a disk failure and the database needs to be recovered by using available archived redo logs.
RUN
{
SET UNTIL SEQUENCE 1234 THREAD 1;
RESTORE CONTROLFILE ;
ALTER DATABASE MOUNT;
RESTORE DATABASE;
RECOVER DATABASE; # recovers through log 1233
ALTER DATABASE OPEN RESETLOGS;
}
Performing Incomplete Recovery to a Specified SCN: Example
This example (which assumes a mounted database) recovers the database until a specified SCN:
RUN
{
ALLOCATE CHANNEL ch1 TYPE sbt;
RESTORE DATABASE;
RECOVER DATABASE UNTIL SCN 1000; # recovers through SCN 999
ALTER DATABASE OPEN RESETLOGS;
}
Performing Incomplete Recovery to a Restore Point: Example
This example (which assumes that the database starts out not mounted) recovers the database until a specified restore point:
STARTUP MOUNT;
RUN
{
SET UNTIL RESTORE POINT 'before_batch';
RESTORE DATABASE;
RECOVER DATABASE;
ALTER DATABASE OPEN RESETLOGS;
}
Reporting Obsolete Backups: Example
This example assumes that you want to be able to recover to any point within the last week. It considers as obsolete all backups that could be used to recover the database to a point one week ago:
REPORT OBSOLETE UNTIL TIME 'SYSDATE-7';
"UPGRADE CATALOG"
Upgrade the recovery catalog schema from an older version to the version required by the RMAN executable.
Note that UPGRADE CATALOG does not run scripts to perform. the upgrade. Instead, RMAN sends various SQL DDL statements to the recovery catalog to update the recovery catalog schema with new tables, views, columns, and so forth.
Upgrading a Recovery Catalog: Example
This example connects to recovery catalog database recdb at the operating system command line and then upgrades it to a more current version:
% rman CATALOG rcat/rcat@recdb
connected to recovery catalog database
PL/SQL package rcat.DBMS_RCVCAT version 08.00.04 in RCVCAT database is too old
RMAN> UPGRADE CATALOG
recovery catalog owner is rcat
enter UPGRADE CATALOG command again to confirm catalog upgrade
RMAN> UPGRADE CATALOG
recovery catalog upgraded to version 09.00.01
DBMS_RCVMAN package upgraded to version 09.00.01
DBMS_RCVCAT package upgraded to version 09.00.01
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-615576/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/9240380/viewspace-615576/