這篇文章主要介紹“怎么利用rman傳輸表空間”,在日常操作中,相信很多人在怎么利用rman傳輸表空間問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”怎么利用rman傳輸表空間”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

創新互聯建站于2013年創立,先為蘆山等服務建站,蘆山等地企業,進行企業商務咨詢服務。為蘆山企業網站制作PC+手機+微官網三網同步一站式服務解決您的所有建站問題。
利用imp/impdp傳輸表空間transport_tablespace滿足以下條件
1.字符集相同
2.要導出的表空間必須是read only,而且是自包含的,就是說該表空間的對象不能依賴其他表空間。
3.先導出源數據,傳輸表空間的數據文件拷貝到另一個數據庫相應目錄下。
而RMAN不需要表空間READ ONLY,因為它是備份集進行傳輸,但是也需要字符集相同和自包含。
下面基于RMAN傳輸表空間的測試。
測試環境
源數據庫:
OS=RHEL 6.4;
DB=ORACLE11GR2 ;
IP=192.168.1.171;
SID=hjj;
ASM存儲。
目標數據庫:
OS=WIN7 64BIT;
DB=ORACLE11GR2;
IP=192.168.1.1;
SID=orcl;
FS存儲。
一、在源數據庫端
1.創建測試表空間
SQL> create tablespace tt1 datafile '+DATA_DG/hjj/datafile/test01.dbf' size 100m;
Tablespace created.
2.創建用戶并授權
SQL> create user tt1 identified by oracle default tablespace tt1;
User created.
SQL> grant connect,resource to tt1;
Grant succeeded.
3.創建測試表
SQL> create table tt1.t as select * from dba_objects;
Table created.
4.查看數據
SQL> conn tt1/oracle
Connected.
SQL> select count(*) from t;
COUNT(*)
----------
21293
4.確認傳輸表空間的平臺是否兼容
在源數據庫端:
SQL> select tp.* from v$transportable_platform tp,v$database d where tp.PLATFORM_NAME = d.PLATFORM_NAME;
PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- -------------------------------------------------- --------------
10 Linux IA (32-bit) Little
在目標數據庫端:
SQL> select tp.* from v$transportable_platform tp,v$database d where tp.PLATFORM_NAME = d.PLATFORM_NAME;
PLATFORM_ID PLATFORM_NAME ENDIAN_FORMAT
----------- -------------------------------------------------- ----------------------------
12 Microsoft Windows x86 64-bit Little
可以看到windows平臺和linux都是Little,是兼容的。
5.確認源數據庫的表空間是否自包含
SQL> exec dbms_tts.transport_set_check('tt1',true,true);
PL/SQL procedure successfully completed.
SQL> select * from transport_set_violations;
no rows selected
6.備份源數據庫
[oracle@myrac1 ~]$ rman target sys/oracle@hjj catalog rman/rman
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Mar 5 19:54:06 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: HJJ (DBID=2845675742)
connected to recovery catalog database
RMAN> sql "alter system checkpoint";
starting full resync of recovery catalog
full resync complete
sql statement: alter system checkpoint
RMAN> sql "alter system archive log current";
sql statement: alter system archive log current
RMAN> sql "alter system switch logfile";
sql statement: alter system switch logfile
RMAN> backup database;
Starting backup at 05-MAR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA_DG/hjj/datafile/system.260.837919351
input datafile file number=00002 name=+DATA_DG/hjj/datafile/sysaux.261.837919391
input datafile file number=00005 name=+DATA_DG/hjj/datafile/tbs01.dbf
input datafile file number=00003 name=+DATA_DG/hjj/datafile/undotbs1.262.837919417
input datafile file number=00007 name=+DATA_DG/hjj/datafile/tt01.dbf
input datafile file number=00006 name=+DATA_DG/hjj/datafile/rman_tbs0.dbf
input datafile file number=00004 name=+DATA_DG/hjj/datafile/users.264.837919457
channel ORA_DISK_1: starting piece 1 at 05-MAR-14
channel ORA_DISK_1: finished piece 1 at 05-MAR-14
piece handle=+DG_FRA/hjj/backupset/2014_03_05/nnndf0_tag20140305t215129_0.265.841441893 tag=TAG20140305T215129 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15
Finished backup at 05-MAR-14
Starting Control File and SPFILE Autobackup at 05-MAR-14
piece handle=+DG_FRA/hjj/autobackup/2014_03_05/s_841441968.267.841441969 comment=NONE
Finished Control File and SPFILE Autobackup at 05-MAR-14
RMAN> backup archivelog all;
Starting backup at 05-MAR-14
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=88 RECID=47 STAMP=841355567
input archived log thread=1 sequence=89 RECID=48 STAMP=841366180
input archived log thread=1 sequence=90 RECID=49 STAMP=841433642
input archived log thread=1 sequence=91 RECID=50 STAMP=841434920
input archived log thread=1 sequence=92 RECID=51 STAMP=841434930
input archived log thread=1 sequence=93 RECID=52 STAMP=841435200
input archived log thread=1 sequence=94 RECID=53 STAMP=841439190
input archived log thread=1 sequence=95 RECID=54 STAMP=841439198
input archived log thread=1 sequence=96 RECID=55 STAMP=841439439
input archived log thread=1 sequence=97 RECID=56 STAMP=841439759
input archived log thread=1 sequence=98 RECID=57 STAMP=841440347
input archived log thread=1 sequence=99 RECID=58 STAMP=841441558
input archived log thread=1 sequence=100 RECID=59 STAMP=841441564
input archived log thread=1 sequence=101 RECID=60 STAMP=841442014
channel ORA_DISK_1: starting piece 1 at 05-MAR-14
channel ORA_DISK_1: finished piece 1 at 05-MAR-14
piece handle=+DG_FRA/hjj/backupset/2014_03_05/annnf0_tag20140305t215336_0.264.841442017 tag=TAG20140305T215336 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:08
Finished backup at 05-MAR-14
Starting Control File and SPFILE Autobackup at 05-MAR-14
piece handle=+DG_FRA/hjj/autobackup/2014_03_05/s_841442025.263.841442027 comment=NONE
Finished Control File and SPFILE Autobackup at 05-MAR-14
RMAN> backup current controlfile;
Starting backup at 05-MAR-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 05-MAR-14
channel ORA_DISK_1: finished piece 1 at 05-MAR-14
piece handle=+DG_FRA/hjj/backupset/2014_03_05/ncnnf0_tag20140305t215401_0.262.841442045 tag=TAG20140305T215401 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 05-MAR-14
Starting Control File and SPFILE Autobackup at 05-MAR-14
piece handle=+DG_FRA/hjj/autobackup/2014_03_05/s_841442048.261.841442051 comment=NONE
Finished Control File and SPFILE Autobackup at 05-MAR-14
說明:這里使用全庫備份,因為除了目標表空間的備份以外,RMAN還需要SYSTEM、SYSAUX以及UNDO表空間的備份,如果任意一個表空間的備份不存在,則就會導致“RMAN-06019: 無法轉換表空間名稱"TTB1"”的錯誤。
7.生成傳輸集(源數據庫上)
RMAN> transport tablespace tt1 tablespace destination '/s01/dd' auxiliary destination '/s01/dd';
Creating automatic instance, with SID='CDty'
initialization parameters used for automatic instance:
db_name=HJJ
db_unique_name=CDty_tspitr_HJJ
compatible=11.2.0.0.0
db_block_size=8192
db_files=200
sga_target=280M
processes=50
db_create_file_dest=/s01/dd
log_archive_dest_1='location=/s01/dd'
#No auxiliary parameter file used
starting up automatic instance HJJ
Oracle instance started
Total System Global Area 292933632 bytes
Fixed Size 1336092 bytes
Variable Size 100666596 bytes
Database Buffers 184549376 bytes
Redo Buffers 6381568 bytes
Automatic instance created
Running TRANSPORT_SET_CHECK on recovery set tablespaces
TRANSPORT_SET_CHECK completed successfully
contents of Memory Script:
{
# set requested point in time
set until scn 2004003;
# restore the controlfile
restore clone controlfile;
# mount the controlfile
sql clone 'alter database mount clone database';
# archive current online log
sql 'alter system archive log current';
# resync catalog
resync catalog;
}
executing Memory Script
executing command: SET until clause
Starting restore at 05-MAR-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=59 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +DG_FRA/hjj/autobackup/2014_03_05/s_841441968.267.841441969
channel ORA_AUX_DISK_1: piece handle=+DG_FRA/hjj/autobackup/2014_03_05/s_841441968.267.841441969 tag=TAG20140305T215248
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
output file name=/s01/dd/HJJ/controlfile/o1_mf_9kj3fpmt_.ctl
Finished restore at 05-MAR-14
sql statement: alter database mount clone database
sql statement: alter system archive log current
starting full resync of recovery catalog
full resync complete
contents of Memory Script:
{
# set requested point in time
set until scn 2004003;
# set destinations for recovery set and auxiliary set datafiles
set newname for clone datafile 1 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 2 to new;
set newname for clone tempfile 1 to new;
set newname for datafile 7 to
"/s01/dd/tt01.dbf";
# switch all tempfiles
switch clone tempfile all;
# restore the tablespaces in the recovery set and the auxiliary set
restore clone datafile 1, 3, 2, 7;
switch clone datafile all;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to /s01/dd/HJJ/datafile/o1_mf_temp_%u_.tmp in control file
Starting restore at 05-MAR-14
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /s01/dd/HJJ/datafile/o1_mf_system_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /s01/dd/HJJ/datafile/o1_mf_undotbs1_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /s01/dd/HJJ/datafile/o1_mf_sysaux_%u_.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /s01/dd/tt01.dbf
channel ORA_AUX_DISK_1: reading from backup piece +DG_FRA/hjj/backupset/2014_03_05/nnndf0_tag20140305t215129_0.265.841441893
channel ORA_AUX_DISK_1: piece handle=+DG_FRA/hjj/backupset/2014_03_05/nnndf0_tag20140305t215129_0.265.841441893 tag=TAG20140305T215129
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:56
Finished restore at 05-MAR-14
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=841442234 file name=/s01/dd/HJJ/datafile/o1_mf_system_9kj3g6mv_.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=841442234 file name=/s01/dd/HJJ/datafile/o1_mf_undotbs1_9kj3g77n_.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=841442234 file name=/s01/dd/HJJ/datafile/o1_mf_sysaux_9kj3g706_.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=8 STAMP=841442234 file name=/s01/dd/tt01.dbf
contents of Memory Script:
{
# set requested point in time
set until scn 2004003;
# online the datafiles restored or switched
sql clone "alter database datafile 1 online";
sql clone "alter database datafile 3 online";
sql clone "alter database datafile 2 online";
sql clone "alter database datafile 7 online";
# recover and open resetlogs
recover clone database tablespace "TT1", "SYSTEM", "UNDOTBS1", "SYSAUX" delete archivelog;
alter clone database open resetlogs;
}
executing Memory Script
executing command: SET until clause
sql statement: alter database datafile 1 online
sql statement: alter database datafile 3 online
sql statement: alter database datafile 2 online
sql statement: alter database datafile 7 online
Starting recover at 05-MAR-14
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 101 is already on disk as file /s01/app/oracle/archivelog/1_101_837919326.dbf
archived log file name=/s01/app/oracle/archivelog/1_101_837919326.dbf thread=1 sequence=101
media recovery complete, elapsed time: 00:00:00
Finished recover at 05-MAR-14
database opened
contents of Memory Script:
{
# make read only the tablespace that will be exported
sql clone 'alter tablespace TT1 read only';
# create directory for datapump export
sql clone "create or replace directory STREAMS_DIROBJ_DPDIR as ''
/s01/dd''";
}
executing Memory Script
sql statement: alter tablespace TT1 read only
sql statement: create or replace directory STREAMS_DIROBJ_DPDIR as ''/s01/dd''
Performing export of metadata...
EXPDP> Starting "SYS"."TSPITR_EXP_CDty":
EXPDP> Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
EXPDP> Processing object type TRANSPORTABLE_EXPORT/TABLE
EXPDP> Processing object type TRANSPORTABLE_EXPORT/POST_INSTANCE/PLUGTS_BLK
EXPDP> Master table "SYS"."TSPITR_EXP_CDty" successfully loaded/unloaded
EXPDP> ******************************************************************************
EXPDP> Dump file set for SYS.TSPITR_EXP_CDty is:
EXPDP> /s01/dd/dmpfile.dmp
EXPDP> ******************************************************************************
EXPDP> Datafiles required for transportable tablespace TT1:
EXPDP> /s01/dd/tt01.dbf
EXPDP> Job "SYS"."TSPITR_EXP_CDty" successfully completed at 22:00:01
Export completed
--------------------------------------------------------------
-- Start of sample PL/SQL script for importing the tablespaces
--------------------------------------------------------------
-- creating directory objects
CREATE DIRECTORY STREAMS$DIROBJ$1 AS '/s01/dd/';
CREATE DIRECTORY STREAMS$DIROBJ$DPDIR AS '/s01/dd';
DECLARE
-- the datafiles
tbs_files dbms_streams_tablespace_adm.file_set;
cvt_files dbms_streams_tablespace_adm.file_set;
-- the dumpfile to import
dump_file dbms_streams_tablespace_adm.file;
dp_job_name VARCHAR2(30) := NULL;
-- names of tablespaces that were imported
ts_names dbms_streams_tablespace_adm.tablespace_set;
BEGIN
-- dump file name and location
dump_file.file_name := 'dmpfile.dmp';
dump_file.directory_object := 'STREAMS$DIROBJ$DPDIR';
-- forming list of datafiles for import
tbs_files( 1).file_name := 'tt01.dbf';
tbs_files( 1).directory_object := 'STREAMS$DIROBJ$1';
-- import tablespaces
dbms_streams_tablespace_adm.attach_tablespaces(
datapump_job_name => dp_job_name,
dump_file => dump_file,
tablespace_files => tbs_files,
converted_files => cvt_files,
tablespace_names => ts_names);
-- output names of imported tablespaces
IF ts_names IS NOT NULL AND ts_names.first IS NOT NULL THEN
FOR i IN ts_names.first .. ts_names.last LOOP
dbms_output.put_line('imported tablespace '|| ts_names(i));
END LOOP;
END IF;
END;
/
-- dropping directory objects
DROP DIRECTORY STREAMS$DIROBJ$1;
DROP DIRECTORY STREAMS$DIROBJ$DPDIR;
--------------------------------------------------------------
-- End of sample PL/SQL script
--------------------------------------------------------------
Removing automatic instance
shutting down automatic instance
database closed
database dismounted
Oracle instance shut down
Automatic instance removed
auxiliary instance file /s01/dd/HJJ/datafile/o1_mf_temp_9kj3l8ph_.tmp deleted
auxiliary instance file /s01/dd/HJJ/onlinelog/o1_mf_3_9kj3l3lr_.log deleted
auxiliary instance file /s01/dd/HJJ/onlinelog/o1_mf_2_9kj3l20t_.log deleted
auxiliary instance file /s01/dd/HJJ/onlinelog/o1_mf_1_9kj3l0b0_.log deleted
auxiliary instance file /s01/dd/HJJ/datafile/o1_mf_sysaux_9kj3g706_.dbf deleted
auxiliary instance file /s01/dd/HJJ/datafile/o1_mf_undotbs1_9kj3g77n_.dbf deleted
auxiliary instance file /s01/dd/HJJ/datafile/o1_mf_system_9kj3g6mv_.dbf deleted
auxiliary instance file /s01/dd/HJJ/controlfile/o1_mf_9kj3fpmt_.ctl deleted
傳輸完成后會自動刪除臨時目錄/s01/dd下的文件。
查看目錄/s01/dd
[root@myrac1 dd]# ll
total 102508
-rw-r----- 1 oracle asmadmin 90112 Mar 5 22:00 dmpfile.dmp
drwxr-x--- 5 oracle asmadmin 4096 Mar 5 21:25 HJJ
-rw-r--r-- 1 oracle oinstall 2022 Mar 5 22:00 impscrpt.sql
-rw-r----- 1 oracle asmadmin 104865792 Mar 5 21:57 tt01.dbf
impscrpt.sql --元數據信息,目標數據庫必須存在相應的對象屬主,數據文件路徑不一致還要修改腳本。
dmpfile.dmp --也是元數據信息,如果使用dump文件導入元數據信息則就沒有上面的限制了。
tt01.dbf --數據文件,可以發現生成的數據文件和原來的數據文件一模一樣。
HJJ是/s01/dd下的一個臨時目錄。
8.目標數據庫中導入元數據集
a.使用asm存儲體系,使用dump導入
convert datafile '/opt/tts/td/tts.288.755520393' format '+datagroup';
如果是使用的asm則需要把os上面的文件放到asm里面,上面這條命令可以在os和asm之間轉換數據文件。
impdp system/oracle@orcl directory=dp dumpfile=dmpfile.dmp nologfile=y transport_datafiles='+DATAGROUP/ORCL/DATAFILE/TTS.290.755528197';
b.使用文件系統,使用dump導入。
impdp system/oracle@orcl directory=dp dumpfile=dmpfile.dmp nologfile=y transport_datafiles='/opt/oradata/tts.288.755520393';
c.@/opt/tts/td/impsctpt.sql
9.復制源數據庫/s01/dd目錄和數據文件到目標數據庫D:\dd
D:\dd>ls
dmpfile.alg dmpfile.dmp impscrpt.sql tt01.dbf
10.檢查源數據庫和目標數據庫的數據塊大小是否一致
源數據庫:
SQL> select block_size from dba_tablespaces where tablespace_name = 'TT1';
BLOCK_SIZE
----------
8192
目標數據庫:
SQL> show parameter db_block_size
NAME TYPE VALUE
------------------------------------ ---------------------- ---------
db_block_size integer 8192
11.在目標數據上創建用戶
C:\>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 6 14:25:09 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> create user tt1 identified by oracle;
User created.
SQL> grant connect,resource to tt1;
Grant succeeded.
運行impscrpt.sql腳本
SQL> @D:\dd\impscrpt.sql
Directory created.
Directory created.
DECLARE
*
ERROR at line 1:
ORA-06512: at "SYS.DBMS_STREAMS_TABLESPACE_ADM", line 1854
ORA-06512: at line 18
Directory dropped.
Directory dropped.
查看dmpfile.alg文件,發現
Master table "SYS"."SYS_IMPORT_TRANSPORTABLE_04" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TRANSPORTABLE_04":
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-29345: cannot plug a tablespace into a database using an incompatible character set
Job "SYS"."SYS_IMPORT_TRANSPORTABLE_04" stopped due to fatal error at 14:58:40
提示不能將表空間導入到字符集不兼容的數據庫
查看源數據庫和目標數據庫的字符集
源數據庫:
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.WE8MSWIN1252
目標數據庫:
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
------------------------------------------
AMERICAN_AMERICA.AL32UTF8
字符集確實不一致,但是我可以使用impdp手動導入設置,在win下設置NLS_LANG
按照自己的想法試試
SQL> create directory dp as 'd:\dd';
Directory created.
D:\dd>impdp system/oracle@orcl directory=dp dumpfile=dmpfile.dmp nologfile=y transport_datafiles='tt01.dbf';
Import: Release 11.2.0.1.0 - Production on Thu Mar 6 14:51:07 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/********@orcl directory=dp dumpfile=dmpfile.dmp nologfile=y transport_datafiles='tt01.dbf';
Processing object type TRANSPORTABLE_EXPORT/PLUGTS_BLK
ORA-39123: Data Pump transportable tablespace job aborted
ORA-29345: cannot plug a tablespace into a database using an incompatible character set
Job "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" stopped due to fatal error at 14:51:15
發現報同樣的錯誤,字符集不兼容。修改目標數據庫的字符集為源數據庫字符集
SQL> conn / as sysdba
Connected to an idle instance.
SQL> alter database character set INTERNAL_USE WE8MSWIN1252;
alter database character set INTERNAL_USE WE8MSWIN1252
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
SQL> startup mount
ORACLE instance started.
Total System Global Area 1235959808 bytes
Fixed Size 2175288 bytes
Variable Size 956305096 bytes
Database Buffers 268435456 bytes
Redo Buffers 9043968 bytes
Database mounted.
SQL> alter database character set INTERNAL_USE WE8MSWIN1252;
alter database character set INTERNAL_USE WE8MSWIN1252
*
ERROR at line 1:
ORA-12719: operation requires database is in RESTRICTED mode
SQL> alter system enable restricted session;
System altered.
SQL> alter database character set internal_use WE8MSWIN1252;
alter database character set internal_use WE8MSWIN1252
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01109: database not open
SQL> alter database open;
Database altered.
SQL> alter database character set internal_use WE8MSWIN1252;
Database altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 1235959808 bytes
Fixed Size 2175288 bytes
Variable Size 956305096 bytes
Database Buffers 268435456 bytes
Redo Buffers 9043968 bytes
Database mounted.
SQL> alter system disable restricted session;
System altered.
SQL> alter database open;
Database altered.
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.WE8MSWIN1252
再次使用impdp導入
D:\dd>impdp system/oracle@orcl directory=dp dumpfile=dmpfile.dmp nologfile=y transport_datafiles='d:\dd\tt01.dbf'
Import: Release 11.2.0.1.0 - Production on Thu Mar 6 15:59:43 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_TRANSPORTABLE_01": system/********@orcl directory=dp dumpfile=dmpfile.dmp nologfile=y transport_datafiles='d:\dd\tt01.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 15:59:57
impdp執行,你可以運行impscrpt.sql,也是成功。因為兩種方式報的錯誤都是一樣的。
D:\dd>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu Mar 6 16:02:02 2014
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter user tt1 defalut tablespace tt1;
alter user tt1 defalut tablespace tt1
*
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> alter user tt1 default tablespace tt1;
User altered.
目標端導入的表空間默認是READ-ONLY;將表空間改為READ WRITE
SQL> select tablespace_name,status from dba_tablespaces where tablespace_name = 'TT1';
TABLESPACE_NAME STATUS
------------------------------ ---------
TT1 READ ONLY
SQL> alter tablespace tt1 read write;
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces where tablespace_name = 'TT1';
TABLESPACE_NAME STATUS
------------------------------ ---------
TT1 ONLINE
SQL> conn tt1/oracle
Connected.
SQL> select count(*) from t;
COUNT(*)
----------
21293
至此表空間從linux ASM磁盤組遷移到win FS系統下。
遇到的問題以及注意項
1.源數據庫表空間的名字不能為test,因為test是RMAN的關鍵字。
RMAN> transport tablespace test tablespace destination "/s01/dd" auxiliary destination "/s01/dd";
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "test": expecting one of: "double-quoted-string, identifier, single-quoted-string"
RMAN-01007: at line 1 column 22 file: standard input
http://docs.oracle.com/cd/B19306_01/backup.102/b14194/rcmcomma001.htm#RCMRF909有說明
2.如果兩個平臺的字節順序不一致,可以使用rman進行轉化。
RMAN> convert tablespace tt1 to platform 'Microsoft Windows IA (32-bit)' format '/tmp/%N_%F';
RMAN> convert datafile '/tmp/BOOKS_5' db_file_name_convert '/tmp/BOOKS_5','/tmp/books01.dbf';
3.創建傳輸集過程報錯如下
ORA-19502: write error on file "/s01/dd/HJJ/datafile/o1_mf_system_9kj14qc1_.dbf", block number 82816 (block size=8192)
ORA-27072: File I/O error
Linux Error: 25: Inappropriate ioctl for device
Additional information: 4
Additional information: 82816
Additional information: 344064
auxiliary instance file /s01/dd/HJJ/controlfile/o1_mf_9kj148lp_.ctl deleted
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of transport tablespace command at 03/05/2014 21:18:59
RMAN-03015: error occurred in stored script Memory Script
RMAN-06136: ORACLE error from auxiliary database: ORA-01180: can not create datafile 1
ORA-01110: data file 1: '+DATA_DG/hjj/datafile/system.260.837919351'
因為創建傳輸集時,需要一個臨時目錄/s01/dd,會將備份集中的datafile,onlinelog,controlfile存放于此,所以要提前估算好空間。
這個錯誤就是因為空間不足引起的。
到此,關于“怎么利用rman傳輸表空間”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注創新互聯網站,小編會繼續努力為大家帶來更多實用的文章!
文章題目:怎么利用rman傳輸表空間
網頁地址:http://www.js-pz168.com/article16/jgdjgg.html
成都網站建設公司_創新互聯,為您提供域名注冊、品牌網站制作、網站策劃、電子商務、、網站維護
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯