课程第33次
select* from v$asm_diskgroup;
select* from v$asm_attribute;
select* from v$transportable_platform;
begin
dbms_tts.transport_set_check(ts_list => 'tbs05319x');
end;
select * from transport_set_violations;
VIOLATIONS
1ORA-39907: 索引 HR.I1 (在表空间 TBS05319X 中) 指向表 HR.T1 (在表空间 TBS05319 中)。
begin
dbms_tts.transport_set_check(ts_list => 'tbs05319x,tbs05319');
end;
select * from transport_set_violations;获取帮助:
PS C:\WINDOWS\system32> expdphelp=y
Export: Release 11.2.0.4.0 - Production on 星期日 7月 28 10:20:37 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
数据泵导出实用程序提供了一种用于在 Oracle 数据库之间传输
数据对象的机制。该实用程序可以使用以下命令进行调用:
示例: expdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
您可以控制导出的运行方式。具体方法是: 在 'expdp' 命令后输入
各种参数。要指定各参数, 请使用关键字:
格式:expdp KEYWORD=value 或 KEYWORD=(value1,value2,...,valueN)
示例: expdp scott/tiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=scott
或 TABLES=(T1:P1,T1:P2), 如果 T1 是分区表
USERID 必须是命令行中的第一个参数。
------------------------------------------------------------------------------
以下是可用关键字和它们的说明。方括号中列出的是默认值。
ATTACH
连接到现有作业。
例如, ATTACH=job_name。
CLUSTER
利用集群资源并将 worker 进程分布在 Oracle RAC 上。
有效的关键字值为: 和 N。
COMPRESSION
减少转储文件大小。
有效的关键字值为: ALL, DATA_ONLY, 和 NONE。
CONTENT
指定要卸载的数据。
有效的关键字值为: , DATA_ONLY 和 METADATA_ONLY。
DATA_OPTIONS
数据层选项标记。
有效的关键字值为: XML_CLOBS。
DIRECTORY
用于转储文件和日志文件的目录对象。
DUMPFILE
指定目标转储文件名的列表 。
例如, DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp。
ENCRYPTION
加密某个转储文件的一部分或全部。
有效的关键字值为: ALL, DATA_ONLY, ENCRYPTED_COLUMNS_ONLY, METADATA_ONLY 和 NONE。
ENCRYPTION_ALGORITHM
指定加密的方式。
有效的关键字值为: , AES192 和 AES256。
ENCRYPTION_MODE
生成加密密钥的方法。
有效的关键字值为: DUAL, PASSWORD 和 。
ENCRYPTION_PASSWORD
用于在转储文件中创建加密数据的口令密钥。
ESTIMATE
计算作业估计值。
有效的关键字值为: 和 STATISTICS。
ESTIMATE_ONLY
计算作业估计值而不执行导出。
EXCLUDE
排除特定对象类型。
例如, EXCLUDE=SCHEMA:"='HR'"。
FILESIZE
以字节为单位指定每个转储文件的大小。
FLASHBACK_SCN
用于重置会话快照的 SCN。
FLASHBACK_TIME
用于查找最接近的相应 SCN 值的时间。
FULL
导出整个数据库 。
HELP
显示帮助消息 。
INCLUDE
包括特定对象类型。
例如, INCLUDE=TABLE_DATA。
JOB_NAME
要创建的导出作业的名称。
LOGFILE
指定日志文件名 。
NETWORK_LINK
源系统的远程数据库链接的名称。
NOLOGFILE
不写入日志文件 。
PARALLEL
更改当前作业的活动 worker 的数量。
PARFILE
指定参数文件名。
QUERY
用于导出表的子集的谓词子句。
例如, QUERY=employees:"WHERE department_id > 10"。
REMAP_DATA
指定数据转换函数。
例如, REMAP_DATA=EMP.EMPNO:REMAPPKG.EMPNO。
REUSE_DUMPFILES
覆盖目标转储文件 (如果文件存在) 。
SAMPLE
要导出的数据的百分比。
SCHEMAS
要导出的方案的列表 [登录方案]。
SERVICE_NAME
约束 Oracle RAC 资源的活动服务名和关联资源组。
SOURCE_EDITION
用于提取元数据的版本。
STATUS
监视作业状态的频率, 其中
默认值 表示只要有新状态可用, 就立即显示新状态。
TABLES
标识要导出的表的列表。
例如, TABLES=HR.EMPLOYEES,SH.SALES:SALES_1995。
TABLESPACES
标识要导出的表空间的列表。
TRANSPORTABLE
指定是否可以使用可传输方法。
有效的关键字值为: ALWAYS 和 。
TRANSPORT_FULL_CHECK
验证所有表的存储段 。
TRANSPORT_TABLESPACES
要从中卸载元数据的表空间的列表。
VERSION
要导出的对象版本。
有效的关键字值为: , LATEST 或任何有效的数据库版本。
------------------------------------------------------------------------------
下列命令在交互模式下有效。
注: 允许使用缩写。
ADD_FILE
将转储文件添加到转储文件集。
CONTINUE_CLIENT
返回到事件记录模式。如果处于空闲状态, 将重新启动作业。
EXIT_CLIENT
退出客户机会话并使作业保持运行状态。
FILESIZE
用于后续 ADD_FILE 命令的默认文件大小 (字节)。
HELP
汇总交互命令。
KILL_JOB
分离并删除作业。
PARALLEL
更改当前作业的活动 worker 的数量。
REUSE_DUMPFILES
覆盖目标转储文件 (如果文件存在) 。
START_JOB
启动或恢复当前作业。
有效的关键字值为: SKIP_CURRENT。
STATUS
监视作业状态的频率, 其中
默认值 表示只要有新状态可用, 就立即显示新状态。
STOP_JOB
按顺序关闭作业执行并退出客户机。
有效的关键字值为: IMMEDIATE。
PS C:\WINDOWS\system32>
PS C:\WINDOWS\system32> expdp system/oracle_4U directory=dirwin dumpfile=tbs05319.dmpTRANSPORT_TABLESPACES=tbs05319,tbs05319x
Export: Release 11.2.0.4.0 - Production on 星期日 7月 28 10:26:22 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":system/******** directory=dirwin dumpfile=tbs05319.dmp TRANSPORT_TABLESPACES=tbs05319,tbs05319x
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/INDEX/INDEX
处理对象类型 TRANSPORTABLE_EXPORT/INDEX_STATISTICS
处理对象类型 TRANSPORTABLE_EXPORT/TABLE_STATISTICS
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
已成功加载/卸载了主表 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01"
******************************************************************************
SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:
C:\APP\APPLE\DIRWIN\TBS05319.DMP
******************************************************************************
可传输表空间 TBS05319 所需的数据文件:
C:\APP\APPLE\ORADATA\WINORCL\TBS05319.DBF
可传输表空间 TBS05319X 所需的数据文件:
C:\APP\APPLE\ORADATA\WINORCL\TBS05319X.DBF
作业 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" 已于 星期日 7月 28 10:26:58 2019 elapsed 0 00:00:34 成功完成
PS C:\WINDOWS\system32>
因为都是小码机,所以不用转码,直接拷贝C:\APP\APPLE\ORADATA\WINORCL\TBS05319X.DBF和C:\APP\APPLE\DIRWIN\TBS05319.DMP到Linux
$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sun Jul 28 10:32:54 2019
Copyright (c) 1982, 2013, Oracle.All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> create directorydirlin as '/u01/app/oracle/dirlin';
Directory created.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
$ impdp help=y
Import: Release 11.2.0.4.0 - Production on Sun Jul 28 10:33:58 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
The Data Pump Import utility provides a mechanism for transferring data objects
between Oracle databases. The utility is invoked with the following command:
Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
You can control how Import runs by entering the 'impdp' command followed
by various parameters. To specify parameters, you use keywords:
Format:impdp KEYWORD=value or KEYWORD=(value1,value2,...,valueN)
Example: impdp scott/tiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
USERID must be the first parameter on the command line.
------------------------------------------------------------------------------
The available keywords and their descriptions follow. Default values are listed within square brackets.
ATTACH
Attach to an existing job.
For example, ATTACH=job_name.
CLUSTER
Utilize cluster resources and distribute workers across the Oracle RAC.
Valid keyword values are: and N.
CONTENT
Specifies data to load.
Valid keywords are: , DATA_ONLY and METADATA_ONLY.
DATA_OPTIONS
Data layer option flags.
Valid keywords are: SKIP_CONSTRAINT_ERRORS.
DIRECTORY
Directory object to be used for dump, log and SQL files.
DUMPFILE
List of dump files to import from .
For example, DUMPFILE=scott1.dmp, scott2.dmp, dmpdir:scott3.dmp.
ENCRYPTION_PASSWORD
Password key for accessing encrypted data within a dump file.
Not valid for network import jobs.
ESTIMATE
Calculate job estimates.
Valid keywords are: and STATISTICS.
EXCLUDE
Exclude specific object types.
For example, EXCLUDE=SCHEMA:"='HR'".
FLASHBACK_SCN
SCN used to reset session snapshot.
FLASHBACK_TIME
Time used to find the closest corresponding SCN value.
FULL
Import everything from source .
HELP
Display help messages .
INCLUDE
Include specific object types.
For example, INCLUDE=TABLE_DATA.
JOB_NAME
Name of import job to create.
LOGFILE
Log file name .
NETWORK_LINK
Name of remote database link to the source system.
NOLOGFILE
Do not write log file .
PARALLEL
Change the number of active workers for current job.
PARFILE
Specify parameter file.
PARTITION_OPTIONS
Specify how partitions should be transformed.
Valid keywords are: DEPARTITION, MERGE and .
QUERY
Predicate clause used to import a subset of a table.
For example, QUERY=employees:"WHERE department_id > 10".
REMAP_DATA
Specify a data conversion function.
For example, REMAP_DATA=EMP.EMPNO:REMAPPKG.EMPNO.
REMAP_DATAFILE
Redefine data file references in all DDL statements.
REMAP_SCHEMA
Objects from one schema are loaded into another schema.
REMAP_TABLE
Table names are remapped to another table.
For example, REMAP_TABLE=HR.EMPLOYEES:EMPS.
REMAP_TABLESPACE
Tablespace objects are remapped to another tablespace.
REUSE_DATAFILES
Tablespace will be initialized if it already exists .
SCHEMAS
List of schemas to import.
SERVICE_NAME
Name of an active Service and associated resource group to constrain Oracle RAC resources.
SKIP_UNUSABLE_INDEXES
Skip indexes that were set to the Index Unusable state.
SOURCE_EDITION
Edition to be used for extracting metadata.
SQLFILE
Write all the SQL DDL to a specified file.
STATUS
Frequency (secs) job status is to be monitored where
the default will show new status when available.
STREAMS_CONFIGURATION
Enable the loading of Streams metadata
TABLE_EXISTS_ACTION
Action to take if imported object already exists.
Valid keywords are: APPEND, REPLACE, and TRUNCATE.
TABLES
Identifies a list of tables to import.
For example, TABLES=HR.EMPLOYEES,SH.SALES:SALES_1995.
TABLESPACES
Identifies a list of tablespaces to import.
TARGET_EDITION
Edition to be used for loading metadata.
TRANSFORM
Metadata transform to apply to applicable objects.
Valid keywords are: OID, PCTSPACE, SEGMENT_ATTRIBUTES and STORAGE.
TRANSPORTABLE
Options for choosing transportable data movement.
Valid keywords are: ALWAYS and .
Only valid in NETWORK_LINK mode import operations.
TRANSPORT_DATAFILES
List of data files to be imported by transportable mode.
TRANSPORT_FULL_CHECK
Verify storage segments of all tables .
TRANSPORT_TABLESPACES
List of tablespaces from which metadata will be loaded.
Only valid in NETWORK_LINK mode import operations.
VERSION
Version of objects to import.
Valid keywords are: , LATEST or any valid database version.
Only valid for NETWORK_LINK and SQLFILE.
------------------------------------------------------------------------------
The following commands are valid while in interactive mode.
Note: abbreviations are allowed.
CONTINUE_CLIENT
Return to logging mode. Job will be restarted if idle.
EXIT_CLIENT
Quit client session and leave job running.
HELP
Summarize interactive commands.
KILL_JOB
Detach and delete job.
PARALLEL
Change the number of active workers for current job.
START_JOB
Start or resume current job.
Valid keywords are: SKIP_CURRENT.
STATUS
Frequency (secs) job status is to be monitored where
the default will show new status when available.
STOP_JOB
Orderly shutdown of job execution and exits the client.
Valid keywords are: IMMEDIATE.
$ impdp system/oracle_4Udirectory=dirlin dumpfile=TBS05319.DMP TRANSPORT_DATAFILES='/u01/app/oracle/oradata/orcl/TBS05319.DBF','/u01/app/oracle/oradata/orcl/TBS05319X.DBF'
Import: Release 11.2.0.4.0 - Production on Sun Jul 28 10:39:09 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Source time zone is +08:00 and target time zone is +00:00.
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":system/******** directory=dirlin dumpfile=TBS05319.DMP TRANSPORT_DATAFILES=/u01/app/oracle/oradata/orcl/TBS05319.DBF,/u01/app/oracle/oradata/orcl/TBS05319X.DBF
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/INDEX/INDEX
Processing object type TRANSPORTABLE_EXPORT/INDEX_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/TABLE_STATISTICS
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Sun Jul 28 10:39:22 2019 elapsed 0 00:00:10
在学完1Z0-052的第17章的时候,还要注意“versions”和“remap_schema”
--------------------------------------做一下要求转码的拓展实验:
PS C:\WINDOWS\system32> expdp system/oracle_4U directory=dirwin dumpfile=tbssolaris.dmpTRANSPORT_TABLESPACES=tbssolaris
Export: Release 11.2.0.4.0 - Production on 星期日 7月 28 10:58:06 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
连接到: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
启动 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01":system/******** directory=dirwin dumpfile=tbssolaris.dmp TRANSPORT_TABLESPACES=tbssolaris
处理对象类型 TRANSPORTABLE_EXPORT/PLUGTS_BLK
处理对象类型 TRANSPORTABLE_EXPORT/TABLE
处理对象类型 TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
已成功加载/卸载了主表 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01"
******************************************************************************
SYSTEM.SYS_EXPORT_TRANSPORTABLE_01 的转储文件集为:
C:\APP\APPLE\DIRWIN\TBSSOLARIS.DMP
******************************************************************************
可传输表空间 TBSSOLARIS 所需的数据文件:
C:\APP\APPLE\ORADATA\WINORCL\TBSSOLARIS.DBF
作业 "SYSTEM"."SYS_EXPORT_TRANSPORTABLE_01" 已于 星期日 7月 28 10:58:47 2019 elapsed 0 00:00:39 成功完成
PS C:\WINDOWS\system32> rman target/
恢复管理器: Release 11.2.0.4.0 - Production on 星期日 7月 28 10:58:59 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
已连接到目标数据库: WINORCL (DBID=2162311502)
RMAN> convert tablespace tbssolaris to platform 'Solaris OE (32-bit)' format 'c:\app\apple\dirwin\tbssolaris_%U.dbf';
启动 conversion at source 于 28-7月 -19
使用目标数据库控制文件替代恢复目录
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=198 设备类型=DISK
通道 ORA_DISK_1: 启动数据文件转换
输入数据文件: 文件号=00008 名称=C:\APP\APPLE\ORADATA\WINORCL\TBSSOLARIS.DBF
已转换的数据文件 = C:\APP\APPLE\DIRWIN\TBSSOLARIS_DATA_D-WINORCL_I-2162311502_TS-TBSSOLARIS_FNO-8_03U7PF2C.DBF
通道 ORA_DISK_1: 数据文件转换完毕, 经过时间: 00:00:01
完成 conversion at source 于 28-7月 -19
RMAN>直接导入,出错:
<p>$ impdp system/oracle_4Udirectory=dirlin dumpfile=TBSSOLARIS.DMP TRANSPORT_DATAFILES='/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF'
Import: Release 11.2.0.4.0 - Production on Sun Jul 28 11:14:24 2019</p><p>Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.</p><p>Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Source time zone is +08:00 and target time zone is +00:00.
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":system/******** directory=dirlin dumpfile=TBSSOLARIS.DMP TRANSPORT_DATAFILES=/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-01565: error in identifying file '/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF'
ORA-27048: skgfifi: file header information is invalid
Additional information: 24</p><p>Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" stopped due to fatal error at Sun Jul 28 11:14:28 2019 elapsed 0 00:00:02
</p>所以,需要在目的地这边转码(如果源头不能再来一次的话):
$ rman target/
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Jul 28 11:06:21 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
connected to target database: ORCL (DBID=1541741703)
RMAN> convert datafile '/u01/app/oracle/oradata/orcl/TBSSOLARIDS_ORI.DBF' from platform 'Solaris OE (32-bit)' format '/u01/app/oracle/oradata/orcl/TBSSOLARIDS.DBF';
Starting conversion at target at 2019-07-28:11:08:13
using target database control file instead of recovery catalog
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=72 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=68 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Secure Backup
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of conversion at target command at 07/28/2019 11:08:31
ORA-19625: error identifying file /u01/app/oracle/oradata/orcl/TBSSOLARIDS_ORI.DBF
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
RMAN> exit
Recovery Manager complete.
$ ls -l/u01/app/oracle/oradata/orcl/TBSSOLARIDS_ORI.DBF
ls: cannot access /u01/app/oracle/oradata/orcl/TBSSOLARIDS_ORI.DBF: No such file or directory
$ cd /u01/app/oracle/oradata/orcl/
$ ls
TBS05319.DBFTBS05319X.DBFTBSSOLARIS_ORI.DBF
$ cd
$ rman target/
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Jul 28 11:09:32 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
connected to target database: ORCL (DBID=1541741703)
RMAN>convert datafile '/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF' from platform 'Solaris OE (32-bit)' format '/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF';
Starting conversion at target at 2019-07-28:11:09:55
using target database control file instead of recovery catalog
allocated channel: ORA_SBT_TAPE_1
channel ORA_SBT_TAPE_1: SID=72 device type=SBT_TAPE
channel ORA_SBT_TAPE_1: Oracle Secure Backup
allocated channel: ORA_SBT_TAPE_2
channel ORA_SBT_TAPE_2: SID=69 device type=SBT_TAPE
channel ORA_SBT_TAPE_2: Oracle Secure Backup
DBGANY: CMD type=backup cmdid=1 status=NOT STARTED
DBGANY: 1 STEPstepid=1 cmdid=1 status=NOT STARTED devtype=DISK
DBGANY: 1 TEXTNOD = -- budf_start
DBGANY: 2 TEXTNOD = /* This must be retriable, which means a backup conversation may already
DBGANY: 3 TEXTNOD =* be in progress when this step (re)executes.
DBGANY: 4 TEXTNOD =*/
DBGANY: 5 TEXTNOD = declare
DBGANY: 6 TEXTNOD = /* backup conversation status variables */
DBGANY: 7 TEXTNOD = state binary_integer;
DBGANY: 8 TEXTNOD = setid number;
DBGANY: 9 TEXTNOD = stamp number;
DBGANY: 10 TEXTNOD = pieceno binary_integer;
DBGANY: 11 TEXTNOD = files binary_integer;
DBGANY: 12 TEXTNOD = datafiles boolean;
DBGANY: 13 TEXTNOD = incremental boolean;
DBGANY: 14 TEXTNOD = nochecksumboolean;
DBGANY: 15 TEXTNOD = device boolean;
DBGANY: 16 TEXTNOD = hdrupd boolean:= TRUE;
DBGANY: 17 TEXTNOD = /* piece creation variables */
DBGANY: 18 TEXTNOD = done boolean;
DBGANY: 19 TEXTNOD = concur boolean;
DBGANY: 20 TEXTNOD = chg_tracking_err number;
DBGANY: 21 TEXTNOD = /* Miscellaneous */
DBGANY: 22 TEXTNOD = memnum number;
DBGANY: 23 TEXTNOD = dfnumber number;
DBGANY: 24 TEXTNOD = cfname varchar2(512);
DBGANY: 25 TEXTNOD = copy_recidnumber;
DBGANY: 26 TEXTNOD = copy_stampnumber;
DBGANY: 27 TEXTNOD = busy_retries number := 0;
DBGANY: 28 TEXTNOD = resetlogs_changenumber;
DBGANY: 29 TEXTNOD = creation_change number;
DBGANY: 30 TEXTNOD = checkpoint_change number;
DBGANY: 31 TEXTNOD = blksize number;
DBGANY: 32 TEXTNOD = blocks number;
DBGANY: 33 TEXTNOD = fname varchar2(1024);
DBGANY: 34 TEXTNOD = no_delete binary_integer;
DBGANY: 35 TEXTNOD = copy number;
DBGANY: 36 TEXTNOD = nformat number := 1;
DBGANY: 37 TEXTNOD = handle varchar2(512);
DBGANY: 38 TEXTNOD = comment varchar2(80);
DBGANY: 39 TEXTNOD = media varchar2(80);
DBGANY: 40 TEXTNOD = wrong_format exception;
DBGANY: 41 TEXTNOD = pragma exception_init(wrong_format, -20039);
DBGANY: 42 TEXTNOD = first_time boolean := TRUE;
DBGANY: 43 TEXTNOD = backup_level number;
DBGANY: 44 TEXTNOD = elapsed number;
DBGANY: 45 TEXTNOD = starttime date;
DBGANY: 46 TEXTNOD = hours number;
DBGANY: 47 TEXTNOD = mins number;
DBGANY: 48 TEXTNOD = secs number;
DBGANY: 49 TEXTNOD = ncopies number := 0;
DBGANY: 50 TEXTNOD = docompress boolean := FALSE;
DBGANY: 51 TEXTNOD = compressalg varchar2(80);
DBGANY: 52 TEXTNOD = compressasof number;
DBGANY: 53 TEXTNOD = compresslopt binary_integer;
DBGANY: 54 TEXTNOD = /* backup_type is used to indicate what type of backup is done. This is used
DBGANY: 55 TEXTNOD = * to get configured copies, look at krmkgbac for more comments. */
DBGANY: 56 TEXTNOD = backup_type number := 2;
DBGANY: 57 TEXTNOD = isstby boolean;
DBGANY: 58 TEXTNOD = larchlog_failover boolean;
DBGANY: 59 TEXTNOD = failoverdone boolean := FALSE;
DBGANY: 60 TEXTNOD = docopies boolean := FALSE;
DBGANY: 61 TEXTNOD = cnvrtto boolean := FALSE;
DBGANY: 62 TEXTNOD = cnvrtfr boolean := FALSE;
DBGANY: 63 TEXTNOD = sameen boolean := FALSE;
DBGANY: 64 TEXTNOD = reusefile boolean := FALSE;
DBGANY: 65 TEXTNOD = tsname varchar2(30) := NULL;
DBGANY: 66 TEXTNOD = thread number := NULL;
DBGANY: 67 TEXTNOD = sequence number := NULL;
DBGANY: 68 TEXTNOD = m number := 8581;
DBGANY: 69 TEXTNOD = cprecid number;
DBGANY: 70 TEXTNOD = cpstamp number;
DBGANY: 71 TEXTNOD = rsid number;
DBGANY: 72 TEXTNOD = rsts number;
DBGANY: 73 TEXTNOD = cptag varchar2(31) := NULL;
DBGANY: 74 TEXTNOD = noct boolean := FALSE;
DBGANY: 75 TEXTNOD = nooptim boolean := FALSE;
DBGANY: 76 TEXTNOD = dontcare varchar2(1);
DBGANY: 77 TEXTNOD = pltfrmto number := NULL;
DBGANY: 78 TEXTNOD = pltfrmfr number := NULL;
DBGANY: 79 TEXTNOD = foreign_dbname varchar2(8) := NULL;
DBGANY: 80 TEXTNOD = foreign_dbid number := NULL;
DBGANY: 81 TEXTNOD = doconvert boolean := FALSE;
DBGANY: 82 TEXTNOD = savepiecename boolean := FALSE;
DBGANY: 83 TEXTNOD = transontarget boolean := FALSE;
DBGANY: 84 TEXTNOD = transonlyundo boolean := FALSE;
DBGANY: 85 TEXTNOD = convertdb boolean := FALSE;
DBGANY: 86 TEXTNOD = processfile boolean := TRUE;
DBGANY: 87 TEXTNOD = isomf boolean;
DBGANY: 88 TEXTNOD = istmplt boolean;
DBGANY: 89 TEXTNOD = isasm boolean;
DBGANY: 90 TEXTNOD = validatecmd boolean;
DBGANY: 91 TEXTNOD = validateopt boolean;
DBGANY: 92 TEXTNOD = newcorrupt boolean; -- TRUE if new corruption is found
DBGANY: 93 TEXTNOD = updateok boolean;
DBGANY: 94 TEXTNOD = snapshot_cf boolean;
DBGANY: 95 TEXTNOD = /* Multi-section backup fields */
DBGANY: 96 TEXTNOD = msb_secbytes number := 0;
DBGANY: 97 TEXTNOD = msb_file_size number;
DBGANY: 98 TEXTNOD = msb_set_stamp number;
DBGANY: 99 TEXTNOD = msb_set_count number;
DBGANY: 100 TEXTNOD = msb_section_sizenumber;
DBGANY: 101 TEXTNOD = msb_first_section number;
DBGANY: 102 TEXTNOD = msb_section_count number;
DBGANY: 103 TEXTNOD = msb_piece_numbernumber;
DBGANY: 104 TEXTNOD = msb_piece_count number;
DBGANY: 105 TEXTNOD = cnvrt_need_format exception;
DBGANY: 106 TEXTNOD = bkp_need_format exception;
DBGANY: 107 TEXTNOD = pragma exception_init(cnvrt_need_format, -20038);
DBGANY: 108 TEXTNOD = pragma exception_init(bkp_need_format, -20045);
DBGANY: 109 TEXTNOD = begin
DBGANY: 110 TEXTNOD =
DBGANY: 111 PRMVAL =backup_level := null;
DBGANY: 112 TEXTNOD = -- set docopies and convert (if any)
DBGANY: 113 TEXTNOD =
DBGANY: 114 PRMVAL =docopies := true; cnvrtfr := true; pltfrmto := 13; pltfrmfr := 1; transontarget := false;
DBGANY: 115 TEXTNOD = -- set rsid
DBGANY: 116 TEXTNOD =
DBGANY: 117 PRMVAL =rsid := 9;
DBGANY: 118 TEXTNOD = -- set rsts
DBGANY: 119 TEXTNOD =
DBGANY: 120 PRMVAL =rsts := 1014808195;
DBGANY: 121 TEXTNOD = -- set reusefile
DBGANY: 122 TEXTNOD =
DBGANY: 123 PRMVAL =reusefile := false;
DBGANY: 124 TEXTNOD = -- set validatecmd and validateopt := FALSE/TRUE
DBGANY: 125 TEXTNOD =
DBGANY: 126 PRMVAL =validatecmd := false; validateopt := false;
DBGANY: 127 TEXTNOD = -- set docompress := FALSE/TRUE
DBGANY: 128 TEXTNOD =
DBGANY: 129 PRMVAL =docompress := false;
DBGANY: 130 TEXTNOD = -- set msb_secbytes
DBGANY: 131 TEXTNOD =
DBGANY: 132 PRMVAL =msb_secbytes := 0;
DBGANY: 133 TEXTNOD = -- set compressalg
DBGANY: 134 TEXTNOD =
DBGANY: 135 PRMVAL =compressalg := NULL;
DBGANY: 136 TEXTNOD = if pltfrmto is not null or pltfrmfr is not null then
DBGANY: 137 TEXTNOD = doconvert := true;
DBGANY: 138 TEXTNOD = end if;
DBGANY: 139 TEXTNOD = -- If returned FALSE, abort the backup job
DBGANY: 140 TEXTNOD = if (NOT beginBackupJobStep()) then
DBGANY: 141 TEXTNOD = return;
DBGANY: 142 TEXTNOD = end if;
DBGANY: 143 TEXTNOD =
DBGANY: 144 TEXTNOD = sys.dbms_backup_restore.backupStatus(state, setid, stamp, pieceno, files,
DBGANY: 145 TEXTNOD = datafiles, incremental, nochecksum,
DBGANY: 146 TEXTNOD = device);
DBGANY: 147 TEXTNOD = if state = sys.dbms_backup_restore.BACKUP_NO_CONVERSATION then
DBGANY: 148 TEXTNOD = goto start_convo;
DBGANY: 149 TEXTNOD = elsif state = sys.dbms_backup_restore.BACKUP_NAMING_FILES then
DBGANY: 150 TEXTNOD = goto name_files;
DBGANY: 151 TEXTNOD = else
DBGANY: 152 TEXTNOD = goto create_piece;
DBGANY: 153 TEXTNOD = end if;
DBGANY: 154 TEXTNOD = <<start_convo>>
DBGANY: 155 TEXTNOD = sys.dbms_backup_restore.setRmanStatusRowId(rsid=>rsid, rsts=>rsts);
DBGANY: 156 TEXTNOD = sys.dbms_backup_restore.backupSetDatafile(stamp, setid,
DBGANY: 157 TEXTNOD =
DBGANY: 158 PRMVAL = validateblk=>false,incremental=>false,nocatalog=>false,nochecksum=>false
DBGANY: 159 TEXTNOD = ,
DBGANY: 160 TEXTNOD =
DBGANY: 161 PRMVAL = tag=>null
DBGANY: 162 TEXTNOD = ,
DBGANY: 163 TEXTNOD = backup_level => backup_level,
DBGANY: 164 TEXTNOD = imagcp => docopies,
DBGANY: 165 TEXTNOD = convertto => cnvrtto,
DBGANY: 166 TEXTNOD = convertfr => cnvrtfr,
DBGANY: 167 TEXTNOD = pltfrmto=> pltfrmto,
DBGANY: 168 TEXTNOD = pltfrmfr=> pltfrmfr,
DBGANY: 169 TEXTNOD = sameen => sameen,
DBGANY: 170 TEXTNOD = convertdb => convertdb,
DBGANY: 171 TEXTNOD = validate=> validateopt,
DBGANY: 172 TEXTNOD = hdrupd => hdrupd);
DBGANY: 173 TEXTNOD = if hdrupd then
DBGANY: 174 TEXTNOD = krmicd.writeMsg(6782);
DBGANY: 175 TEXTNOD = krmicd.writeMsg(6785);
DBGANY: 176 TEXTNOD = updateok := sys.dbms_backup_restore.UpdateHeaders();
DBGANY: 177 TEXTNOD = if not updateok then
DBGANY: 178 TEXTNOD = krmicd.writeMsg(6784);
DBGANY: 179 TEXTNOD = krmicd.writeMsg(8191,
DBGANY: 180 TEXTNOD = sys.dbms_backup_restore.getParm(
DBGANY: 181 TEXTNOD = sys.dbms_backup_restore.TRACE_FILENAME));
DBGANY: 182 TEXTNOD = end if;
DBGANY: 183 TEXTNOD = krmicd.writeMsg(6783);
DBGANY: 184 TEXTNOD = end if;
DBGANY: 185 TEXTNOD = if (noct) then
DBGANY: 186 TEXTNOD = dontcare :=
DBGANY: 187 TEXTNOD = sys.dbms_backup_restore.getParm(sys.dbms_backup_restore.incr_noct);
DBGANY: 188 TEXTNOD = end if;
DBGANY: 189 TEXTNOD = if (nooptim) then
DBGANY: 190 TEXTNOD = dontcare :=
DBGANY: 191 TEXTNOD = sys.dbms_backup_restore.getParm(sys.dbms_backup_restore.full_nooptim);
DBGANY: 192 TEXTNOD = end if;
DBGANY: 193 TEXTNOD = -- Display appropriate message
DBGANY: 194 TEXTNOD = if docopies then
DBGANY: 195 TEXTNOD = -- convertdb messages are moved to budf_name
DBGANY: 196 TEXTNOD = if not convertdb then
DBGANY: 197 TEXTNOD = if doconvert then
DBGANY: 198 TEXTNOD = krmicd.writeMsg(8589, krmicd.getChid);
DBGANY: 199 TEXTNOD = else
DBGANY: 200 TEXTNOD = krmicd.writeMsg(8580, krmicd.getChid);
DBGANY: 201 TEXTNOD = end if;
DBGANY: 202 TEXTNOD = end if;
DBGANY: 203 TEXTNOD = else
DBGANY: 204 TEXTNOD = if backup_level is not null then
DBGANY: 205 TEXTNOD = if (docompress) then
DBGANY: 206 TEXTNOD = krmicd.writeMsg(8047, krmicd.getChid, to_char(backup_level));
DBGANY: 207 TEXTNOD = else
DBGANY: 208 TEXTNOD = krmicd.writeMsg(8048, krmicd.getChid, to_char(backup_level));
DBGANY: 209 TEXTNOD = end if;
DBGANY: 210 TEXTNOD = else
DBGANY: 211 TEXTNOD = if (docompress) then
DBGANY: 212 TEXTNOD = krmicd.writeMsg(8046, krmicd.getChid);
DBGANY: 213 TEXTNOD = elsif (validatecmd) then
DBGANY: 214 TEXTNOD = krmicd.writeMsg(8140, krmicd.getChid);
DBGANY: 215 TEXTNOD = else
DBGANY: 216 TEXTNOD = krmicd.writeMsg(8008, krmicd.getChid);
DBGANY: 217 TEXTNOD = end if;
DBGANY: 218 TEXTNOD = end if;
DBGANY: 219 TEXTNOD = end if;
DBGANY: 220 TEXTNOD = setBackupParams(docopies);
DBGANY: 221 TEXTNOD = <<name_files>>
DBGANY: 222 TEXTNOD = deb('budf_start', 'set_stamp=' || stamp || ' set_count=' || setid,
DBGANY: 223 TEXTNOD = rman_constant.DEBUG_IO, rman_constant.LEVEL_MIN);
DBGANY: 224 TEXTNOD = -- bucv_name
DBGANY: 225 TEXTNOD =
DBGANY: 226 PRMVAL =memnum := 1;
DBGANY: 227 TEXTNOD =
DBGANY: 228 PRMVAL =foreign_dbname := 'WINORCL'; foreign_dbid := 2162311502; tsname := 'TBSSOLARIS'; dfnumber := 8; fname := '/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF';
DBGANY: 229 TEXTNOD = if files < memnum then
DBGANY: 230 TEXTNOD = sys.dbms_backup_restore.convertDataFileCopy(fname,
DBGANY: 231 PRMVAL = max_corrupt=>0
DBGANY: 232 TEXTNOD = );
DBGANY: 233 TEXTNOD = files := files + 1;
DBGANY: 234 TEXTNOD = krmicd.writeMsg(8506, fname);
DBGANY: 235 TEXTNOD = end if;
DBGANY: 236 TEXTNOD = -- bu_create
DBGANY: 237 TEXTNOD = <<create_piece>>
DBGANY: 238 TEXTNOD = sys.dbms_backup_restore.backupStatus(state, setid, stamp, pieceno, files,
DBGANY: 239 TEXTNOD = datafiles, incremental, nochecksum,
DBGANY: 240 TEXTNOD = device);
DBGANY: 241 TEXTNOD = starttime := sysdate;
DBGANY: 242 TEXTNOD = -- If we get here and the files count is zero, then all files in this
DBGANY: 243 TEXTNOD = -- backup set were skipped.
DBGANY: 244 TEXTNOD = if (files = 0) then
DBGANY: 245 TEXTNOD = sys.dbms_backup_restore.backupCancel;
DBGANY: 246 TEXTNOD = krmicd.writeMsg(8057, krmicd.getChid);
DBGANY: 247 TEXTNOD = else
DBGANY: 248 TEXTNOD = -- ncopies will be substituted for ncopies := <number>
DBGANY: 249 TEXTNOD =
DBGANY: 250 PRMVAL =ncopies := 1;
DBGANY: 251 TEXTNOD = if (ncopies = 0) then
DBGANY: 252 TEXTNOD = ncopies := krmicd.getBackupCopies(backup_type, krmicd.getDevType);
DBGANY: 253 TEXTNOD = end if;
DBGANY: 254 TEXTNOD = sys.dbms_backup_restore.setLimit(sys.dbms_backup_restore.dupcnt,
DBGANY: 255 TEXTNOD = ncopies);
DBGANY: 256 TEXTNOD = loop
DBGANY: 257 TEXTNOD = if not docopies then
DBGANY: 258 TEXTNOD = krmicd.writeMsg(8038, krmicd.getChid, to_char(pieceno+1),
DBGANY: 259 TEXTNOD = to_char(sysdate));
DBGANY: 260 TEXTNOD = end if;
DBGANY: 261 TEXTNOD = declare
DBGANY: 262 TEXTNOD = type names is table of varchar2(512) index by binary_integer;
DBGANY: 263 TEXTNOD = fnames names;
DBGANY: 264 TEXTNOD = lformat names;
DBGANY: 265 TEXTNOD = lyear varchar2(4);
DBGANY: 266 TEXTNOD = lday varchar2(2);
DBGANY: 267 TEXTNOD = lmonth varchar2(2);
DBGANY: 268 TEXTNOD = copyaux number;
DBGANY: 269 TEXTNOD = chtype varchar2(16);
DBGANY: 270 TEXTNOD = busy_retries number := 0;
DBGANY: 271 TEXTNOD = piecefmt varchar2(512);
DBGANY: 272 TEXTNOD = orig_fname varchar2(512);
DBGANY: 273 TEXTNOD = set_stamp number;
DBGANY: 274 TEXTNOD = set_count number;
DBGANY: 275 TEXTNOD = deffmt binary_integer;
DBGANY: 276 TEXTNOD = dest binary_integer := 0;
DBGANY: 277 TEXTNOD = netalias varchar2(1000) := NULL;
DBGANY: 278 TEXTNOD = begin
DBGANY: 279 TEXTNOD = <<snapshot>>
DBGANY: 280 TEXTNOD = begin
DBGANY: 281 TEXTNOD = select to_char(sysdate, 'YYYY',
DBGANY: 282 TEXTNOD = 'NLS_CALENDAR=Gregorian'),
DBGANY: 283 TEXTNOD = to_char(sysdate, 'MM',
DBGANY: 284 TEXTNOD = 'NLS_CALENDAR=Gregorian'),
DBGANY: 285 TEXTNOD = to_char(sysdate, 'DD',
DBGANY: 286 TEXTNOD = 'NLS_CALENDAR=Gregorian')
DBGANY: 287 TEXTNOD = into lyear, lmonth, lday
DBGANY: 288 TEXTNOD = from x$dual;
DBGANY: 289 TEXTNOD = -- initializethe format
DBGANY: 290 TEXTNOD = lformat(0) := NULL;
DBGANY: 291 TEXTNOD = -- The following are substituted for variable := value
DBGANY: 292 TEXTNOD = -- format will substituted by array of
DBGANY: 293 TEXTNOD = -- lformat(<number>) := '<format>' , nformat := <number>
DBGANY: 294 TEXTNOD = -- and dest
DBGANY: 295 TEXTNOD =
DBGANY: 296 PRMVAL =lformat(0) := '/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF'; nformat := 1;
DBGANY: 297 TEXTNOD = -- Call genPieceName as many times as ncopies, stored
DBGANY: 298 TEXTNOD = -- generated names into array of fnames.Check in the
DBGANY: 299 TEXTNOD = -- array for duplicated names
DBGANY: 300 TEXTNOD = copy := 0;
DBGANY: 301 TEXTNOD = while copy < ncopies loop
DBGANY: 302 TEXTNOD = begin
DBGANY: 303 TEXTNOD = -- find out the format to use (backup or channel format)
DBGANY: 304 TEXTNOD = piecefmt := lformat(mod(copy, nformat));
DBGANY: 305 TEXTNOD = krmicd.getFormat(format=> piecefmt,
DBGANY: 306 TEXTNOD = copy => copy+1,
DBGANY: 307 TEXTNOD = deffmt=> deffmt,
DBGANY: 308 TEXTNOD = dest => dest);
DBGANY: 309 TEXTNOD = -- If doing image copies and the channel is not a DISK,
DBGANY: 310 TEXTNOD = -- then generate a piece name for DISK type because server
DBGANY: 311 TEXTNOD = -- implicitly creates a disk channel.
DBGANY: 312 TEXTNOD = chtype := krmicd.getDevType;
DBGANY: 313 TEXTNOD = if chtype is null then
DBGANY: 314 TEXTNOD = chtype := 'N/A';
DBGANY: 315 TEXTNOD = elsif (docopies and chtype != 'DISK') then
DBGANY: 316 TEXTNOD = chtype := 'DISK';
DBGANY: 317 TEXTNOD = end if;
DBGANY: 318 TEXTNOD =
DBGANY: 319 PRMVAL =savepiecename := false;
DBGANY: 320 TEXTNOD = if docopies then
DBGANY: 321 TEXTNOD = orig_fname := fname;
DBGANY: 322 TEXTNOD = else
DBGANY: 323 TEXTNOD = orig_fname := NULL;
DBGANY: 324 TEXTNOD = end if;
DBGANY: 325 TEXTNOD = fnames(copy) :=
DBGANY: 326 TEXTNOD = sys.dbms_backup_restore.genPieceName(
DBGANY: 327 TEXTNOD = pno => pieceno+1,
DBGANY: 328 TEXTNOD = set_count => setid,
DBGANY: 329 TEXTNOD = set_stamp => stamp,
DBGANY: 330 TEXTNOD = format => piecefmt,
DBGANY: 331 TEXTNOD = copyno => copy+1,
DBGANY: 332 TEXTNOD = devtype => chtype,
DBGANY: 333 TEXTNOD = year => lyear,
DBGANY: 334 TEXTNOD = month => lmonth,
DBGANY: 335 TEXTNOD = day => lday,
DBGANY: 336 TEXTNOD = dbid => foreign_dbid,
DBGANY: 337 TEXTNOD = ndbname => foreign_dbname,
DBGANY: 338 TEXTNOD = cfseq => NULL, -- not used
DBGANY: 339 TEXTNOD = fileno => dfnumber,
DBGANY: 340 TEXTNOD = tsname => tsname,
DBGANY: 341 TEXTNOD = logseq => to_char(sequence),
DBGANY: 342 TEXTNOD = logthr => thread,
DBGANY: 343 TEXTNOD = imagcp => docopies,
DBGANY: 344 TEXTNOD = savepname => savepiecename,
DBGANY: 345 TEXTNOD = fname => orig_fname,
DBGANY: 346 TEXTNOD = forcnvrt => processfile);
DBGANY: 347 TEXTNOD = -- check if the format specified is an ASM diskgroup
DBGANY: 348 TEXTNOD = istmplt := FALSE;
DBGANY: 349 TEXTNOD = if (chtype = 'DISK') then
DBGANY: 350 TEXTNOD = sys.dbms_backup_restore.isfileNameOMF(
DBGANY: 351 TEXTNOD = fname => fnames(copy),
DBGANY: 352 TEXTNOD = isomf => isomf,
DBGANY: 353 TEXTNOD = isasm => isasm,
DBGANY: 354 TEXTNOD = istmplt => istmplt);
DBGANY: 355 TEXTNOD = if deffmt != 0 then
DBGANY: 356 TEXTNOD = if (doconvert) then
DBGANY: 357 TEXTNOD = raise cnvrt_need_format;
DBGANY: 358 TEXTNOD = elsif (incremental and backup_level is null) then
DBGANY: 359 TEXTNOD = raise bkp_need_format;
DBGANY: 360 TEXTNOD = end if;
DBGANY: 361 TEXTNOD = end if;
DBGANY: 362 TEXTNOD = end if;
DBGANY: 363 TEXTNOD = -- check previous names for collision
DBGANY: 364 TEXTNOD = -- allow OMF template
DBGANY: 365 TEXTNOD = copyaux := 0;
DBGANY: 366 TEXTNOD = while (not istmplt and dest = 0 and copyaux < copy) loop
DBGANY: 367 TEXTNOD = if fnames(copy) = fnames(copyaux) then
DBGANY: 368 TEXTNOD = raise wrong_format;
DBGANY: 369 TEXTNOD = end if;
DBGANY: 370 TEXTNOD = copyaux := copyaux + 1;
DBGANY: 371 TEXTNOD = end loop;
DBGANY: 372 TEXTNOD = -- Store the names of the second copy onwards
DBGANY: 373 TEXTNOD = if (copy > 0) then
DBGANY: 374 TEXTNOD = sys.dbms_backup_restore.backupPieceCrtDupSet(copy,
DBGANY: 375 TEXTNOD = fnames(copy));
DBGANY: 376 TEXTNOD = end if;
DBGANY: 377 TEXTNOD = end;
DBGANY: 378 TEXTNOD = copy := copy + 1;
DBGANY: 379 TEXTNOD = end loop;
DBGANY: 380 TEXTNOD = -- Ok, now do the actual piece creation, we use the 'old'
DBGANY: 381 TEXTNOD = -- interface
DBGANY: 382 TEXTNOD = copy := 0;
DBGANY: 383 TEXTNOD = -- Do not create a backup piece unless we are processing this
DBGANY: 384 TEXTNOD = -- file (i.e. no skip unnecessary files) and we are not
DBGANY: 385 TEXTNOD = -- converting database on target.
DBGANY: 386 TEXTNOD = if processfile and not transontarget then
DBGANY: 387 TEXTNOD = sys.dbms_backup_restore.backupPieceCreate(
DBGANY: 388 TEXTNOD = fname => fnames(copy),
DBGANY: 389 TEXTNOD = pieceno => pieceno,
DBGANY: 390 TEXTNOD = done => done,
DBGANY: 391 TEXTNOD = handle => handle,
DBGANY: 392 TEXTNOD = comment => comment,
DBGANY: 393 TEXTNOD = media => media,
DBGANY: 394 TEXTNOD = concur => concur,
DBGANY: 395 TEXTNOD =
DBGANY: 396 PRMVAL = params=>null
DBGANY: 397 TEXTNOD = ,
DBGANY: 398 TEXTNOD = reuse => reusefile,
DBGANY: 399 TEXTNOD = archlog_failover => larchlog_failover,
DBGANY: 400 TEXTNOD = deffmt => deffmt,
DBGANY: 401 TEXTNOD = recid => cprecid,
DBGANY: 402 TEXTNOD = stamp => cpstamp,
DBGANY: 403 TEXTNOD = tag => cptag,
DBGANY: 404 TEXTNOD = dest => dest,
DBGANY: 405 TEXTNOD = post10_2 => TRUE,
DBGANY: 406 TEXTNOD = netalias => netalias,
DBGANY: 407 TEXTNOD = docompress => docompress,
DBGANY: 408 TEXTNOD = compressalg => compressalg,
DBGANY: 409 TEXTNOD = compressasof => compressasof,
DBGANY: 410 TEXTNOD = compresslopt => compresslopt);
DBGANY: 411 TEXTNOD = -- Needed for DUPLICATE DATABASE with no backup
DBGANY: 412 TEXTNOD = krmicd.fileRestored(ftype => rman_constant.DATAFILE,
DBGANY: 413 TEXTNOD = fno => nvl(dfnumber, 0),
DBGANY: 414 TEXTNOD = thread => 0,
DBGANY: 415 TEXTNOD = sequence => 0,
DBGANY: 416 TEXTNOD = resetscn => 0,
DBGANY: 417 TEXTNOD = resetstamp => 0,
DBGANY: 418 TEXTNOD = fname => handle);
DBGANY: 419 TEXTNOD = -- The post10_2 flag indicates that this RMAN client is from
DBGANY: 420 TEXTNOD = -- version 10.2 or newer. The backup piece context is deleted
DBGANY: 421 TEXTNOD = -- in backupCancel() from this version onwards.
DBGANY: 422 TEXTNOD = sys.dbms_backup_restore.pieceContextGetNumber(sys.dbms_backup_restore.signal_change_tracking_error, chg_tracking_err);
DBGANY: 423 TEXTNOD = if chg_tracking_err = 1 then
DBGANY: 424 TEXTNOD = krmicd.writeMsg(8606);
DBGANY: 425 TEXTNOD = end if;
DBGANY: 426 TEXTNOD = else
DBGANY: 427 TEXTNOD = done := TRUE;
DBGANY: 428 TEXTNOD = end if;
DBGANY: 429 TEXTNOD = if larchlog_failover then
DBGANY: 430 TEXTNOD = failoverdone := TRUE;
DBGANY: 431 TEXTNOD = end if;
DBGANY: 432 TEXTNOD = if concur then
DBGANY: 433 TEXTNOD = krmicd.writeMsg(8135, fname);
DBGANY: 434 TEXTNOD = end if;
DBGANY: 435 TEXTNOD = if done then
DBGANY: 436 TEXTNOD = sys.dbms_backup_restore.backupCancel();
DBGANY: 437 TEXTNOD = end if;
DBGANY: 438 TEXTNOD = exception
DBGANY: 439 TEXTNOD = when sys.dbms_backup_restore.snapshot_enqueue_busy then
DBGANY: 440 TEXTNOD = -- retry up to 180 times, waiting 20 seconds between retries,
DBGANY: 441 TEXTNOD = -- thus attempting to get a snapshot control file for an hour.
DBGANY: 442 TEXTNOD = -- Since we are displaying RMAN-08512 message, user will know
DBGANY: 443 TEXTNOD = -- that RMAN is waiting to get snapshot enqueue.
DBGANY: 444 TEXTNOD = if busy_retries = 180 then
DBGANY: 445 TEXTNOD = krmicd.writeMsg(20029, 'cannot make a snapshot controlfile');
DBGANY: 446 TEXTNOD = sys.dbms_backup_restore.backupCancel();
DBGANY: 447 TEXTNOD = raise;
DBGANY: 448 TEXTNOD = end if;
DBGANY: 449 TEXTNOD = busy_retries := busy_retries + 1;
DBGANY: 450 TEXTNOD = -- print this message every 5 minutes
DBGANY: 451 TEXTNOD = if (mod(busy_retries, 15) = 0) then
DBGANY: 452 TEXTNOD = krmicd.writeMsg(8512);
DBGANY: 453 TEXTNOD = end if;
DBGANY: 454 TEXTNOD = krmicd.sleep(20);
DBGANY: 455 TEXTNOD = krmicd.clearErrors;
DBGANY: 456 TEXTNOD = goto snapshot;
DBGANY: 457 TEXTNOD = end;
DBGANY: 458 TEXTNOD = krmicd.writeIOs(stamp, setid);
DBGANY: 459 TEXTNOD = end; -- snapshot controlfile stuff
DBGANY: 460 TEXTNOD = if not docopies then
DBGANY: 461 TEXTNOD = if ncopies = 1 then
DBGANY: 462 TEXTNOD = krmicd.writeMsg(8044, krmicd.getChid, to_char(pieceno),
DBGANY: 463 TEXTNOD = to_char(sysdate));
DBGANY: 464 TEXTNOD = else
DBGANY: 465 TEXTNOD = -- If we have multiple copies, all copies get the same
DBGANY: 466 TEXTNOD = -- tag, print the tag at the beginning if we have one.
DBGANY: 467 TEXTNOD = if cptag is not null then
DBGANY: 468 TEXTNOD = krmicd.writeMsg(8053, krmicd.getChid, to_char(pieceno),
DBGANY: 469 TEXTNOD = to_char(sysdate), to_char(ncopies),
DBGANY: 470 TEXTNOD = cptag);
DBGANY: 471 TEXTNOD = else
DBGANY: 472 TEXTNOD = krmicd.writeMsg(8045, krmicd.getChid, to_char(pieceno),
DBGANY: 473 TEXTNOD = to_char(sysdate), to_char(ncopies));
DBGANY: 474 TEXTNOD = end if;
DBGANY: 475 TEXTNOD = end if;
DBGANY: 476 TEXTNOD = end if;
DBGANY: 477 TEXTNOD = copy := 0;
DBGANY: 478 TEXTNOD = -- No messages unless the file is being processed
DBGANY: 479 TEXTNOD = -- (i.e. no skip unnecessary files) and we are not
DBGANY: 480 TEXTNOD = -- converting database on target.
DBGANY: 481 TEXTNOD = if processfile and not transontarget then
DBGANY: 482 TEXTNOD = while copy < ncopies loop
DBGANY: 483 TEXTNOD = if (copy > 0) then
DBGANY: 484 TEXTNOD = -- Retrieve output parameters from server structures
DBGANY: 485 TEXTNOD = sys.dbms_backup_restore.backupPieceCrtDupGet(copy,
DBGANY: 486 TEXTNOD = handle,
DBGANY: 487 TEXTNOD = comment,
DBGANY: 488 TEXTNOD = media);
DBGANY: 489 TEXTNOD = end if;
DBGANY: 490 TEXTNOD = if not docopies then
DBGANY: 491 TEXTNOD = if comment is null then comment := 'NONE'; end if;
DBGANY: 492 TEXTNOD = -- If we have only one copy and a tag, print the tag
DBGANY: 493 TEXTNOD = -- next to tbe handle.If we have more than one piece
DBGANY: 494 TEXTNOD = -- print the handle and comment only, the same if we do
DBGANY: 495 TEXTNOD = -- not have a tag.
DBGANY: 496 TEXTNOD = if ncopies = 1 and cptag is not null then
DBGANY: 497 TEXTNOD = krmicd.writeMsg(8530, handle, cptag, comment);
DBGANY: 498 TEXTNOD = else
DBGANY: 499 TEXTNOD = krmicd.writeMsg(8503, handle, comment);
DBGANY: 500 TEXTNOD = end if;
DBGANY: 501 TEXTNOD = else
DBGANY: 502 TEXTNOD = if doconvert then
DBGANY: 503 TEXTNOD = krmicd.writeMsg(8588, handle);
DBGANY: 504 TEXTNOD = else
DBGANY: 505 TEXTNOD = if cptag is NOT NULL then
DBGANY: 506 TEXTNOD = if cprecid = 0 and cpstamp = 0 then
DBGANY: 507 TEXTNOD = krmicd.writeMsg(8592, handle, cptag);
DBGANY: 508 TEXTNOD = else
DBGANY: 509 TEXTNOD = krmicd.writeMsg(8586, handle, cptag,
DBGANY: 510 TEXTNOD = to_char(cprecid),
DBGANY: 511 TEXTNOD = to_char(cpstamp));
DBGANY: 512 TEXTNOD = end if;
DBGANY: 513 TEXTNOD = else
DBGANY: 514 TEXTNOD = krmicd.writeMsg(8501, handle, to_char(cprecid),
DBGANY: 515 TEXTNOD = to_char(cpstamp));
DBGANY: 516 TEXTNOD = end if;
DBGANY: 517 TEXTNOD = end if;
DBGANY: 518 TEXTNOD = end if;
DBGANY: 519 TEXTNOD = copy := copy + 1;
DBGANY: 520 TEXTNOD = end loop;
DBGANY: 521 TEXTNOD = end if;
DBGANY: 522 TEXTNOD = if done then
DBGANY: 523 TEXTNOD = select sysdate-starttime into elapsed from x$dual;
DBGANY: 524 TEXTNOD = dur2time(elapsed, hours, mins, secs);
DBGANY: 525 TEXTNOD = if failoverdone then
DBGANY: 526 TEXTNOD = krmicd.writemsg(8112, krmicd.getChid);
DBGANY: 527 TEXTNOD = end if;
DBGANY: 528 TEXTNOD = if not docopies then
DBGANY: 529 TEXTNOD = m := 8540;
DBGANY: 530 TEXTNOD = elsif processfile then
DBGANY: 531 TEXTNOD = if transontarget then
DBGANY: 532 TEXTNOD = m := 8306;
DBGANY: 533 TEXTNOD = elsif doconvert then
DBGANY: 534 TEXTNOD = m := 8590;
DBGANY: 535 TEXTNOD = end if;
DBGANY: 536 TEXTNOD = end if;
DBGANY: 537 TEXTNOD = if processfile then
DBGANY: 538 TEXTNOD = krmicd.writemsg(m, krmicd.getChid,
DBGANY: 539 TEXTNOD = to_char(hours, 'FM09') || ':' ||
DBGANY: 540 TEXTNOD = to_char(mins,'FM09') || ':' ||
DBGANY: 541 TEXTNOD = to_char(secs,'FM09'));
DBGANY: 542 TEXTNOD = end if;
DBGANY: 543 TEXTNOD = exit;
DBGANY: 544 TEXTNOD = end if;
DBGANY: 545 TEXTNOD = end loop;
DBGANY: 546 TEXTNOD = end if;
DBGANY: 547 TEXTNOD = first_time := TRUE;-- in case we will be deleting what we backed up
DBGANY: 548 TEXTNOD = -- bu_end
DBGANY: 549 TEXTNOD = if (endBackupJobStep(FALSE, 0)) then null; end if;
DBGANY: 550 TEXTNOD = sys.dbms_backup_restore.setRmanStatusRowId(rsid=>0, rsts=>0);
DBGANY: 551 TEXTNOD = exception
DBGANY: 552 TEXTNOD = when others then
DBGANY: 553 TEXTNOD = if (not endBackupJobStep(TRUE, sqlcode)) then
DBGANY: 554 TEXTNOD = raise;
DBGANY: 555 TEXTNOD = end if;
DBGANY: 556 TEXTNOD = sys.dbms_backup_restore.setRmanStatusRowId(rsid=>0, rsts=>0);
DBGANY: 557 TEXTNOD = end;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004: fatal error during execution of command
RMAN-00600: internal error, arguments [] [] [] []
$ rman target/
Recovery Manager: Release 11.2.0.4.0 - Production on Sun Jul 28 11:10:43 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
connected to target database: ORCL (DBID=1541741703)
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE 'SBT_TAPE' PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
CONFIGURE DEVICE TYPE DISK PARALLELISM 8 BACKUP TYPE TO BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL 1 DEVICE TYPE 'SBT_TAPE' PARMS'ENV=(OB_MEDIA_FAMILY=station76)';
CONFIGURE CHANNEL 2 DEVICE TYPE 'SBT_TAPE' PARMS'ENV=(OB_MEDIA_FAMILY=station76)';
CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 250 M;
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS'ENV=(OB_MEDIA_FAMILY=station76)' MAXPIECESIZE 250 M;
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF;
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO disk;
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
RMAN>convert datafile '/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF' from platform 'Solaris OE (32-bit)' format '/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF';
Starting conversion at target at 2019-07-28:11:11:15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=60 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=68 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=51 device type=DISK
allocated channel: ORA_DISK_4
channel ORA_DISK_4: SID=65 device type=DISK
allocated channel: ORA_DISK_5
channel ORA_DISK_5: SID=27 device type=DISK
allocated channel: ORA_DISK_6
channel ORA_DISK_6: SID=75 device type=DISK
allocated channel: ORA_DISK_7
channel ORA_DISK_7: SID=76 device type=DISK
allocated channel: ORA_DISK_8
channel ORA_DISK_8: SID=77 device type=DISK
channel ORA_DISK_1: starting datafile conversion
input file name=/u01/app/oracle/oradata/orcl/TBSSOLARIS_ORI.DBF
converted datafile=/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF
channel ORA_DISK_1: datafile conversion complete, elapsed time: 00:00:01
Finished conversion at target at 2019-07-28:11:11:24
RMAN>
$ impdp system/oracle_4Udirectory=dirlin dumpfile=TBSSOLARIS.DMP TRANSPORT_DATAFILES='/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF'
Import: Release 11.2.0.4.0 - Production on Sun Jul 28 11:16:26 2019
Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Source time zone is +08:00 and target time zone is +00:00.
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01":system/******** directory=dirlin dumpfile=TBSSOLARIS.DMP TRANSPORT_DATAFILES=/u01/app/oracle/oradata/orcl/TBSSOLARIS.DBF
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
Processing object type TRANSPORTABLE_EXPORT/TABLE
Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully completed at Sun Jul 28 11:16:41 2019 elapsed 0 00:00:10
$
左下是alter database backup controlfile to trace as '....'的set 2脚本;右上是Windows下源头传送数据库的脚本;右下是模版建库时录制的脚本:
注意那个“set database”
------------------------------------------------------------------------------------------------附:在目的地转换的脚本:
RUN {
CONVERT
FROM PLATFORM 'Microsoft Windows x86 64-bit'
PARALLELISM 1
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\SYSTEM01.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-SYSTEM_FNO-1_05U7PHC2'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\SYSAUX01.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-SYSAUX_FNO-2_06U7PHC5'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\UNDOTBS01.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-UNDOTBS1_FNO-3_07U7PHC9'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\RCAT01.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-RCAT_FNO-5_08U7PHCC'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\TBS05319.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-TBS05319_FNO-6_09U7PHCD'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\TBS05319X.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-TBS05319X_FNO-7_0AU7PHCE'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\TBSSOLARIS.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-TBSSOLARIS_FNO-8_0BU7PHCG'
DATAFILE 'C:\APP\APPLE\ORADATA\WINORCL\USERS01.DBF' FORMAT 'C:\APP\APPLE\DIRWIN\DATA_D-WINORCL_I-2162311502_TS-USERS_FNO-4_0CU7PHCH'
; }
页:
[1]