TTS 測試筆記
TTS 測試筆記
基本虛擬機器測試伺服器環境和工作目標
源端
10.3.105.33
oracle 11.2.0.4.0
目標端
10.3.105.26
oracle 11.2.0.4.0 ASM
遷移目標表空間orcl.users
------------------------------------------
計劃步驟
1 目標端確認資料庫環境,已經可以使用ASM 磁碟組, 新增業務使用者,刪除users表空間,共享NFS /nfs/mycp
2 源端伺服器掛載NFS,確認讀寫許可權,測試傳輸速度 /nfs/mycp
3 在源資料庫上新增directory,指向/nfs/mycp
4 在源庫上做傳輸集一致性檢查 指令碼完成
conn /as sysdba
exec ww_tts_check
select * from sys.transport_set_violations;
5 停止應用程式之後,停止監聽器,重啟資料庫,將表空間置為只讀模式
/home/oracle/tbs_readonly.sql
6 在源庫上,編輯匯出引數檔案,匯出表空間的後設資料 然後停止資料庫
cat /nfs/mycp/exp.par
expdp system/system parfile=exp.par
sqlplus / as sysdba
shutdown immediate
7 在源庫上,使用cp複製資料檔案,執行復制指令碼
# chown oracle:oinstall /nfs/mycp
$ /nfs/mycp/cp_datafiles.sh
8 在新庫上轉換資料檔案
/nfs/mycp/convert_datafile.sql
9 在新庫上新增目錄,
# chown -R oracle:oinstall /nfs/mycp
sqlplus / as sysdba
CREATE OR REPLACE DIRECTORY mycp AS '/nfs/mycp';
GRANT READ,WRITE ON DIRECTORY mycp TO system;
10 在新庫上,匯入表空間
cat /nfs/mycp/imp.par
impdp system/system parfile=imp.par
11 在新庫上,將表空間改為讀寫模式
/nfs/mycp/tbs_readwrite.sql
------------------------------------------
分步驟指令碼內容
1 目標端確認資料庫環境,已經可以使用ASM 磁碟組, 新增業務使用者,刪除users表空間,共享NFS /nfs/mycp
目標端伺服器 192.168.56.103
# uname -a
Linux node2 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
共享NFS /nfs/mycp
root@node2 ~]# rpm -qa |grep rpcbind
rpcbind-0.2.0-9.el6.x86_64
#
#
# rpm -qa|grep nfs
nfs-utils-1.2.3-26.el6.x86_64
nfs4-acl-tools-0.3.3-6.el6.x86_64
nfs-utils-lib-1.1.5-4.el6.x86_64
# mkdir -p /nfs/mycp
# chown -R oracle:oinstall /nfs
# vi /etc/exports
/nfs *(rw,sync)
# service rpcbind status
rpcbind (pid 1213) is running...
#
# service nfs status
rpc.svcgssd is stopped
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
Starting NFS daemon: [ OK ]
#
# exportfs -r
#
# showmount --export
Export list for node2:
/nfs *
#
源端伺服器 192.168.56.102
# mkdir -p /nfs
# mount 192.168.56.103:/nfs /nfs
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_node1-lv_root
50G 20G 28G 42% /
tmpfs 939M 100K 939M 1% /dev/shm
/dev/sda1 485M 37M 423M 8% /boot
/dev/mapper/vg_node1-lv_home
5.5G 158M 5.1G 3% /home
192.168.56.103:/nfs 50G 25G 23G 53% /nfs
# ls -l /nfs
# su - oracle
$ cd /nfs/mycp
touch 102.log
rm 102.log
源端資料庫確認表空間上的使用者
sqlplus / as sysdba
conn /as sysdba
select distinct owner from dba_segments where tablespace_name='USERS';
select username ,account_status from dba_users;
目標端資料庫,刪除users表空間
SQL> drop tablespace users including contents and datafiles;
drop tablespace users including contents and datafiles
*
ERROR at line 1:
ORA-12919: Can not drop the default permanent tablespace
select name from v$datafile;
create tablespace u3 datafile
'/u01/app/oracle/oradata/orcl/u3.ora' size 10M;
alter database default tablespace u3;
drop tablespace users including contents and datafiles
2 源端伺服器掛載NFS,確認讀寫許可權,測試傳輸速度 /nfs/mycp
$ time cp /u01/app/oracle/oradata/orcl/users01.dbf ./
3 在源資料庫上新增directory,指向/nfs/mycp
create directory dmp_dir
as
'/nfs/mycp';
grant read,write on directory dmp_dir to public;
4 在源庫上做傳輸集一致性檢查 指令碼完成
conn /as sysdba
exec ww_tts_check
select * from sys.transport_set_violations;
create or replace procedure ww_tts_check is
begin
dbms_tts.transport_set_check(
'USERS',
true);
end ww_tts_check;
/
5 停止應用程式之後,停止監聽器,重啟資料庫,將表空間置為只讀模式
/home/oracle/tbs_readonly.sql
ALTER TABLESPACE USERS READ ONLY;
6 在源庫上,編輯匯出引數檔案,匯出表空間的後設資料 然後停止資料庫
cat /nfs/mycp/exp.par
expdp system/system parfile=exp.par
sqlplus / as sysdba
shutdown immediate
vi exp.par
DUMPFILE=expdat.dmp
DIRECTORY=dmp_dir
TRANSPORT_FULL_CHECK=Y
TRANSPORT_TABLESPACES=
USERS
部分日誌內容:
Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
/nfs/mycp/expdat.dmp
******************************************************************************
Datafiles required for transportable tablespace USERS:
/u01/app/oracle/oradata/orcl/users01.dbf
Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully
7 在源庫上,使用cp複製資料檔案,執行復制指令碼
# chown oracle:oinstall /nfs/mycp
$ /nfs/mycp/cp_datafiles.sh
cp /u01/app/oracle/oradata/orcl/users01.dbf /nfs/mycp/users01.dbf
這一步要注意原資料庫中,是否有重名的資料檔案!!
8 在新庫上轉換資料檔案
/nfs/mycp/convert_datafile.sql
RMAN> CONVERT DATAFILE
'/nfs/mycp/lssj_data_01.dbf',
'/nfs/mycp/zwgl_data_14.dbf'
TO PLATFORM="IBM zSeries Based Linux"
FROM PLATFORM="Linux x86 64-bit"
DB_FILE_NAME_CONVERT="/nfs/mycp/", "+DATA01/SJRKK/DATAFILE/"
;
RMAN> CONVERT DATAFILE
'/nfs/mycp/users01.dbf'
DB_FILE_NAME_CONVERT="/nfs/mycp/", "+DATA/"
;
部分日誌內容:
elapsed time: 00:02:05
如果檔案多,可以在convert 時加上並行 PARALLELISM=4 .
這個轉換要在cp結束後自動進行,透過遠端呼叫10伺服器上的rman指令碼。 ?
ssh rac1 /home/oracle/ww_t1.sh
oracle@rac1:~> cat ww_t1.sh
chown oracle:oinstall /nfs/mycp/*
su - oracle <<eof
. /home/oracle/.bash_profile
rman target / log /home/oracle/ww_t1.log append @convert_datafile_571.cmd
exit
EOF
這一步容易出現錯誤的原因:源資料庫的資料檔案有重複
'/nfs/mycp/RKXX_DATAe06.dbf',
'/nfs/mycp/RKXX_DATAe06.dbf',
解決方案:
檢查有多少重名的資料檔案,在rman中單獨convert 是否可行 ??? --》 double_datafilename.txt
select substr(name,instr(name,'/',-1)+1,length(name)) as filename,count(1)
from v$datafile
group by substr(name,instr(name,'/',-1)+1,length(name))
having count(1)>1
9 在新庫上新增目錄,
# chown -R oracle:oinstall /nfs/mycp
sqlplus / as sysdba
CREATE OR REPLACE DIRECTORY mycp AS '/nfs/mycp';
GRANT READ,WRITE ON DIRECTORY mycp TO system;
10 在新庫上,匯入表空間
cat /nfs/mycp/imp.par
impdp system/system parfile=imp.par
DUMPFILE=expdat.dmp
DIRECTORY=mycp
TRANSPORT_DATAFILES=
'+DATA/users01.dbf'
根據需要定製資料檔案所在目錄。
11 在新庫上,將表空間改為讀寫模式
/nfs/mycp/tbs_readwrite.sql
ALTER TABLESPACE USERS read write;
其他:
恢復業務使用者的預設表空間
alter user ww default tablespace users;
select default_tablespace from dba_users where username='WW';
------------------------------------------
</eof<>
基本虛擬機器測試伺服器環境和工作目標
源端
10.3.105.33
oracle 11.2.0.4.0
目標端
10.3.105.26
oracle 11.2.0.4.0 ASM
遷移目標表空間orcl.users
------------------------------------------
計劃步驟
1 目標端確認資料庫環境,已經可以使用ASM 磁碟組, 新增業務使用者,刪除users表空間,共享NFS /nfs/mycp
2 源端伺服器掛載NFS,確認讀寫許可權,測試傳輸速度 /nfs/mycp
3 在源資料庫上新增directory,指向/nfs/mycp
4 在源庫上做傳輸集一致性檢查 指令碼完成
conn /as sysdba
exec ww_tts_check
select * from sys.transport_set_violations;
5 停止應用程式之後,停止監聽器,重啟資料庫,將表空間置為只讀模式
/home/oracle/tbs_readonly.sql
6 在源庫上,編輯匯出引數檔案,匯出表空間的後設資料 然後停止資料庫
cat /nfs/mycp/exp.par
expdp system/system parfile=exp.par
sqlplus / as sysdba
shutdown immediate
7 在源庫上,使用cp複製資料檔案,執行復制指令碼
# chown oracle:oinstall /nfs/mycp
$ /nfs/mycp/cp_datafiles.sh
8 在新庫上轉換資料檔案
/nfs/mycp/convert_datafile.sql
9 在新庫上新增目錄,
# chown -R oracle:oinstall /nfs/mycp
sqlplus / as sysdba
CREATE OR REPLACE DIRECTORY mycp AS '/nfs/mycp';
GRANT READ,WRITE ON DIRECTORY mycp TO system;
10 在新庫上,匯入表空間
cat /nfs/mycp/imp.par
impdp system/system parfile=imp.par
11 在新庫上,將表空間改為讀寫模式
/nfs/mycp/tbs_readwrite.sql
------------------------------------------
分步驟指令碼內容
1 目標端確認資料庫環境,已經可以使用ASM 磁碟組, 新增業務使用者,刪除users表空間,共享NFS /nfs/mycp
目標端伺服器 192.168.56.103
# uname -a
Linux node2 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Red Hat Enterprise Linux Server release 6.3 (Santiago)
Kernel \r on an \m
共享NFS /nfs/mycp
root@node2 ~]# rpm -qa |grep rpcbind
rpcbind-0.2.0-9.el6.x86_64
#
#
# rpm -qa|grep nfs
nfs-utils-1.2.3-26.el6.x86_64
nfs4-acl-tools-0.3.3-6.el6.x86_64
nfs-utils-lib-1.1.5-4.el6.x86_64
# mkdir -p /nfs/mycp
# chown -R oracle:oinstall /nfs
# vi /etc/exports
/nfs *(rw,sync)
# service rpcbind status
rpcbind (pid 1213) is running...
#
# service nfs status
rpc.svcgssd is stopped
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
Starting NFS daemon: [ OK ]
#
# exportfs -r
#
# showmount --export
Export list for node2:
/nfs *
#
源端伺服器 192.168.56.102
# mkdir -p /nfs
# mount 192.168.56.103:/nfs /nfs
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_node1-lv_root
50G 20G 28G 42% /
tmpfs 939M 100K 939M 1% /dev/shm
/dev/sda1 485M 37M 423M 8% /boot
/dev/mapper/vg_node1-lv_home
5.5G 158M 5.1G 3% /home
192.168.56.103:/nfs 50G 25G 23G 53% /nfs
# ls -l /nfs
# su - oracle
$ cd /nfs/mycp
touch 102.log
rm 102.log
源端資料庫確認表空間上的使用者
sqlplus / as sysdba
conn /as sysdba
select distinct owner from dba_segments where tablespace_name='USERS';
select username ,account_status from dba_users;
目標端資料庫,刪除users表空間
SQL> drop tablespace users including contents and datafiles;
drop tablespace users including contents and datafiles
*
ERROR at line 1:
ORA-12919: Can not drop the default permanent tablespace
select name from v$datafile;
create tablespace u3 datafile
'/u01/app/oracle/oradata/orcl/u3.ora' size 10M;
alter database default tablespace u3;
drop tablespace users including contents and datafiles
2 源端伺服器掛載NFS,確認讀寫許可權,測試傳輸速度 /nfs/mycp
$ time cp /u01/app/oracle/oradata/orcl/users01.dbf ./
3 在源資料庫上新增directory,指向/nfs/mycp
create directory dmp_dir
as
'/nfs/mycp';
grant read,write on directory dmp_dir to public;
4 在源庫上做傳輸集一致性檢查 指令碼完成
conn /as sysdba
exec ww_tts_check
select * from sys.transport_set_violations;
create or replace procedure ww_tts_check is
begin
dbms_tts.transport_set_check(
'USERS',
true);
end ww_tts_check;
/
5 停止應用程式之後,停止監聽器,重啟資料庫,將表空間置為只讀模式
/home/oracle/tbs_readonly.sql
ALTER TABLESPACE USERS READ ONLY;
6 在源庫上,編輯匯出引數檔案,匯出表空間的後設資料 然後停止資料庫
cat /nfs/mycp/exp.par
expdp system/system parfile=exp.par
sqlplus / as sysdba
shutdown immediate
vi exp.par
DUMPFILE=expdat.dmp
DIRECTORY=dmp_dir
TRANSPORT_FULL_CHECK=Y
TRANSPORT_TABLESPACES=
USERS
部分日誌內容:
Dump file set for SYS.SYS_EXPORT_TRANSPORTABLE_01 is:
/nfs/mycp/expdat.dmp
******************************************************************************
Datafiles required for transportable tablespace USERS:
/u01/app/oracle/oradata/orcl/users01.dbf
Job "SYS"."SYS_EXPORT_TRANSPORTABLE_01" successfully
7 在源庫上,使用cp複製資料檔案,執行復制指令碼
# chown oracle:oinstall /nfs/mycp
$ /nfs/mycp/cp_datafiles.sh
cp /u01/app/oracle/oradata/orcl/users01.dbf /nfs/mycp/users01.dbf
這一步要注意原資料庫中,是否有重名的資料檔案!!
8 在新庫上轉換資料檔案
/nfs/mycp/convert_datafile.sql
RMAN> CONVERT DATAFILE
'/nfs/mycp/lssj_data_01.dbf',
'/nfs/mycp/zwgl_data_14.dbf'
TO PLATFORM="IBM zSeries Based Linux"
FROM PLATFORM="Linux x86 64-bit"
DB_FILE_NAME_CONVERT="/nfs/mycp/", "+DATA01/SJRKK/DATAFILE/"
;
RMAN> CONVERT DATAFILE
'/nfs/mycp/users01.dbf'
DB_FILE_NAME_CONVERT="/nfs/mycp/", "+DATA/"
;
部分日誌內容:
elapsed time: 00:02:05
如果檔案多,可以在convert 時加上並行 PARALLELISM=4 .
這個轉換要在cp結束後自動進行,透過遠端呼叫10伺服器上的rman指令碼。 ?
ssh rac1 /home/oracle/ww_t1.sh
oracle@rac1:~> cat ww_t1.sh
chown oracle:oinstall /nfs/mycp/*
su - oracle <<eof
. /home/oracle/.bash_profile
rman target / log /home/oracle/ww_t1.log append @convert_datafile_571.cmd
exit
EOF
這一步容易出現錯誤的原因:源資料庫的資料檔案有重複
'/nfs/mycp/RKXX_DATAe06.dbf',
'/nfs/mycp/RKXX_DATAe06.dbf',
解決方案:
檢查有多少重名的資料檔案,在rman中單獨convert 是否可行 ??? --》 double_datafilename.txt
select substr(name,instr(name,'/',-1)+1,length(name)) as filename,count(1)
from v$datafile
group by substr(name,instr(name,'/',-1)+1,length(name))
having count(1)>1
9 在新庫上新增目錄,
# chown -R oracle:oinstall /nfs/mycp
sqlplus / as sysdba
CREATE OR REPLACE DIRECTORY mycp AS '/nfs/mycp';
GRANT READ,WRITE ON DIRECTORY mycp TO system;
10 在新庫上,匯入表空間
cat /nfs/mycp/imp.par
impdp system/system parfile=imp.par
DUMPFILE=expdat.dmp
DIRECTORY=mycp
TRANSPORT_DATAFILES=
'+DATA/users01.dbf'
根據需要定製資料檔案所在目錄。
11 在新庫上,將表空間改為讀寫模式
/nfs/mycp/tbs_readwrite.sql
ALTER TABLESPACE USERS read write;
其他:
恢復業務使用者的預設表空間
alter user ww default tablespace users;
select default_tablespace from dba_users where username='WW';
------------------------------------------
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271063/viewspace-1974779/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- jmeter介面測試筆記JMeter筆記
- 學習筆記之測試筆記
- 【軟體測試】學習筆記筆記
- 大資料測試學習筆記之測試工具集大資料筆記
- JMM測試利器-JCStress學習筆記筆記
- metasploit 滲透測試筆記(meterpreter篇)筆記
- 探索性測試總結筆記筆記
- 《不測的祕密:精準測試之路》筆記筆記
- Jest 測試框架使用的學習筆記框架筆記
- metasploit 滲透測試筆記(基礎篇)筆記
- Allure測試報告完整學習筆記測試報告筆記
- 軟體測試筆記——11.自動化測試和手動測試的選擇筆記
- MogDB/openGauss 壞塊測試-對啟動的影響-測試筆記1筆記
- 筆記六十二:叢集壓力測試筆記
- h5學習筆記:sessionStorage 小測試H5筆記Session
- metasploit滲透測試筆記(內網滲透篇)筆記內網
- Java基礎加強筆記——測試、反射、註解Java筆記反射
- 【滲透測試筆記】之【MSF 弱點掃描】筆記
- 小紅書API介面測試 | 小紅書筆記詳情 API 介面測試指南API筆記
- 測試筆試多選題筆試
- 測試隨筆(test)
- C++學習筆記,知識點+程式碼測試C++筆記
- 記測試流程
- Android面試筆記Android面試筆記
- web 考試筆記Web筆記
- 筆記:面試 - css筆記面試CSS
- 筆記:面試 - React筆記面試React
- 筆記:面試 - Vue筆記面試Vue
- 筆試記錄集筆試
- 單元測試 - 測試場景記錄
- Django筆記三十六之單元測試彙總介紹Django筆記
- Hyperledger Fabric 2.2 學習筆記:測試網路test-network筆記
- 效能測試學習筆記:Loadrunner如何進行引數化?筆記
- pytest標記:查詢測試策略、標記測試函式函式
- 100道測試工程師筆試題工程師筆試
- 測試筆試邏輯思維題筆試
- 開源語音合成庫 coqui TTS 使用記錄UITTS
- BufferQueue的試用筆記筆記
- 新筆記 python 面試筆記Python面試