您好,登錄后才能下訂單哦!
本篇內容主要講解“Oracle數據庫怎么從Linux x86單機遷移到Solaries雙節點RAC集群”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“Oracle數據庫怎么從Linux x86單機遷移到Solaries雙節點RAC集群”吧!
(1)關閉應用服務器所有應用
(2)刪除數據庫中所有用戶數據
DROP USER "XXXX" CASCADE;
oracle@cwgsdb1:~$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Thu Oct 25 10:34:39 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: CAMS (DBID=2649374962) RMAN> delete backup; using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=4048 instance=cams1 device type=DISK List of Backup Pieces BP Key BS Key Pc# Cp# Status Device Type Piece Name ------- ------- --- --- ----------- ----------- ---------- 1 1 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_3.bak 2 2 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_4.bak 3 3 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1.bak 4 4 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_2.bak 5 5 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_6.bak 6 6 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_7.bak 7 7 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_5.bak 8 8 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_8.bak 9 9 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_9.bak 10 10 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_10.bak 11 11 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-00 12 12 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_12 13 13 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-01 14 14 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_14 15 15 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-02 16 16 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-03 17 17 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_17 18 18 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_18 19 19 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_19 20 20 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-04 Do you really want to delete the above objects (enter YES or NO)? YES deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_3.bak RECID=1 STAMP=990407128 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_4.bak RECID=2 STAMP=990407199 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_1.bak RECID=3 STAMP=990407128 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_2.bak RECID=4 STAMP=990407128 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_6.bak RECID=5 STAMP=990407239 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_7.bak RECID=6 STAMP=990407241 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_5.bak RECID=7 STAMP=990407238 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_8.bak RECID=8 STAMP=990407287 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_9.bak RECID=9 STAMP=990407292 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_10.bak RECID=10 STAMP=990407292 deleted backup piece backup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-00 RECID=11 STAMP=990407294 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_12 RECID=12 STAMP=990407671 deleted backup piece backup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-01 RECID=13 STAMP=990407673 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_14 RECID=14 STAMP=990414011 deleted backup piece backup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-02 RECID=15 STAMP=990414013 deleted backup piece backup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-03 RECID=16 STAMP=990410565 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_17 RECID=17 STAMP=990414012 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_18 RECID=18 STAMP=990414013 deleted backup piece backup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_19 RECID=19 STAMP=990414014 deleted backup piece backup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-04 RECID=20 STAMP=990414016 Deleted 20 objects RMAN> list backup; specification does not match any backup in the repository
(1)查看所有在用directories
SQL> set lines 300; SQL> col OWNER for a30; SQL> col DIRECTORY_NAME for a30; SQL> col DIRECTORY_PATH for a50; SQL> select * from dba_directories where DIRECTORY_NAME in ('DIR_DP','DPDATA1'); OWNER DIRECTORY_NAME DIRECTORY_PATH ------------------------------ ------------------------------ -------------------------------------------------- SYS DPDATA1 /u01/app/oracle/dump SYS DIR_DP /u01/app/oracle/admin/cams/dpdump/
(2)清理directories路徑下文件
oracle@cwgsdb1:~$ cd /u01/app/oracle/dumporacle@cwgsdb1:/u01/app/oracle/dump$ ls camsData20181017.dmp camsData20181017.log impdp_camsData20181017.log oracle@cwgsdb1:/u01/app/oracle/dump$ rm * oracle@cwgsdb1:/u01/app/oracle/dump$ cd /u01/app/oracle/admin/cams/dpdump/ oracle@cwgsdb1:/u01/app/oracle/admin/cams/dpdump$ ls channel20181024173831.dmp channel20181024173831.log core20181024173831.dmp core20181024173831.log cwap20181024173831.dmp cwap20181024173831.log oracle@cwgsdb1:/u01/app/oracle/admin/cams/dpdump$ rm * oracle@cwgsdb1:/u01/app/oracle/admin/cams/dpdump$ ls
(1)該服務器掛載NFS,查看NFS信息:
oracle@cwgsdb1:~$ df -k Filesystem 1024-blocks Used Available Capacity Mounted on rpool/ROOT/solaris 205406208 26547648 100958072 21% / /devices 0 0 0 0% /devices /dev 0 0 0 0% /dev ctfs 0 0 0 0% /system/contract proc 0 0 0 0% /proc mnttab 0 0 0 0% /etc/mnttab swap 11726088 2912 11723176 1% /system/volatile objfs 0 0 0 0% /system/object sharefs 0 0 0 0% /etc/dfs/sharetab fd 0 0 0 0% /dev/fd rpool/ROOT/solaris/var 205406208 415600 100958072 1% /var swap 11725976 2800 11723176 1% /tmp rpool/VARSHARE 205406208 3432 100958072 1% /var/share rpool/export 205406208 304 100958072 1% /export rpool/export/home 205406208 320 100958072 1% /export/home rpool/export/home/grid 205406208 1128 100958072 1% /export/home/grid rpool/export/home/oracle 205406208 592 100958072 1% /export/home/oracle rpool/repo 205406208 20656608 100958072 17% /repo rpool 205406208 384 100958072 1% /rpool rpool/VARSHARE/zones 205406208 288 100958072 1% /system/zones rpool/VARSHARE/pkg 205406208 304 100958072 1% /var/share/pkg rpool/VARSHARE/pkg/repositories 205406208 288 100958072 1% /var/share/pkg/repositories 100.100.100.54:/impbackup 51606140 15116928 33867772 31% /backup
(2)調整directory路徑:
create or replace directory dir_dp as '/backup/'; grant read,write on directory dir_dp to public;
(3)查看NFS文件權限:
oracle@cwgsdb1:~$ ls -lrt / total 1692 dr-xr-xr-x 2 root root 2 Oct 6 2015 home drwxr-xr-x 2 root root 2 Sep 28 22:47 media drwxr-xr-x 18 root sys 18 Sep 29 06:58 kernel drwxr-xr-x 7 root sys 23 Sep 29 07:01 platform drwxr-xr-x 3 root sys 5 Sep 29 07:01 boot lrwxrwxrwx 1 root root 10 Sep 29 07:01 sbin -> ./usr/sbin lrwxrwxrwx 1 root root 9 Sep 29 07:01 bin -> ./usr/bin drwxr-xr-x 2 root sys 2 Sep 29 07:01 mnt drwxr-xr-x 7 root root 7 Sep 29 07:04 system drwxr-xr-x 3 root sys 3 Sep 29 07:04 export drwxr-xr-x 4 grid oinstall 7 Sep 30 01:49 soft drwxr-xr-x 2 root root 2 Oct 2 01:36 iso drwxr-xr-x 3 root root 15 Oct 2 01:41 repo drwxr-xr-x 12 root bin 335 Oct 2 01:54 lib drwxr-xr-x 43 root sys 50 Oct 2 02:22 var drwxr-xr-x 4 root root 4 Oct 2 21:02 rpool drwxr-xr-x 3 root oinstall 3 Oct 2 21:07 u01 drwx------ 21 root root 30 Oct 2 23:34 root drwxr-xr-x 35 root sys 47 Oct 3 00:12 usr drwxr-xr-x 2 grid asmadmin 7 Oct 3 04:52 sharedisk drwxr-xr-x 7 root sys 7 Oct 3 07:31 opt drwxr-xr-x 4 root sys 8 Oct 24 01:13 devices drwxr-xr-x 193 root sys 193 Oct 24 01:13 dev dr-xr-xr-x 1 root root 1 Oct 24 01:14 net dr-xr-xr-x 1 root root 1 Oct 24 01:14 nfs4 drwxrwxrwx 2 nobody nobody 4096 Oct 25 14:36 backup drwxr-xr-x 98 root sys 194 Oct 25 16:40 etc drwxrwxrwt 10 root sys 862 Oct 25 16:46 tmp dr-xr-xr-x 192 root root 480032 Oct 25 16:47 proc
oracle@cwgsdb1:/backup$ expdp directory=dir_dp schemas=hr dumpfile=hr.dmp logfile=hr.log parallel=2 CLUSTER=N Export: Release 11.2.0.4.0 - Production on Thu Oct 25 17:18:54 2018 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. Username: system Password: Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options Starting "SYSTEM"."SYS_EXPORT_SCHEMA_02": system/******** directory=dir_dp schemas=hr dumpfile=hr.dmp logfile=hr.log parallel=2 CLUSTER=N Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 448 KB . . exported "HR"."COUNTRIES" 6.367 KB 25 rows . . exported "HR"."DEPARTMENTS" 7.007 KB 27 rows . . exported "HR"."EMPLOYEES" 16.80 KB 107 rows . . exported "HR"."JOBS" 6.992 KB 19 rows . . exported "HR"."JOB_HISTORY" 7.054 KB 10 rows . . exported "HR"."LOCATIONS" 8.273 KB 23 rows . . exported "HR"."REGIONS" 5.476 KB 4 rows Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/ROLE_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE Processing object type SCHEMA_EXPORT/TABLE/TABLE Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT Processing object type SCHEMA_EXPORT/TABLE/COMMENT Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS Processing object type SCHEMA_EXPORT/VIEW/VIEW Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT Processing object type SCHEMA_EXPORT/TABLE/TRIGGER Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS Master table "SYSTEM"."SYS_EXPORT_SCHEMA_02" successfully loaded/unloaded ****************************************************************************** Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_02 is: /backup/hr.dmp Job "SYSTEM"."SYS_EXPORT_SCHEMA_02" successfully completed at Thu Oct 25 17:19:21 2018 elapsed 0 00:00:13
在業務人員完成當日業務后,機構關門,防止業務人員登錄系統做業務。計劃在數據庫遷移完成之后執行日結跑批。
登陸電票前置機weblogic控制臺,使用tail -f命令查看當前是否在刷日志,如果沒有刷日志,則通過控制臺關閉電票前置機應用。
按照應用關閉的邏輯順序,依次關閉原生產環境應用。
(1)原數據庫備份命令
expdp \'/ as sysdba\' DIRECTORY=dpdata1 DUMPFILE=camsData20181025.dmp SCHEMAS=xxxx,yyyy logfile=camsData20181025.log
(2)文件壓縮
tar zcvf camsData20181025.tar.gz camsData20181025.dmp camsData20181025.log
(3)將文件傳輸至新生產數據庫服務器第一個節點中
scp camsData20181025.tar.gz oracle@100.100.100.215:/u01/app/oracle/dump
(4)關閉老生產數據庫
$ lsnrctl stop $ sqlplus / as sysdba SQL> shutdown immediate;
(5)關閉定時任務,在任務之前加#
crontab -e
(6)修改舊數據庫服務器IP地址為其他地址。
按照測試環境驗證過的流程,修改RAC集群的scan ip為生產數據庫IP。
oracle@cwgsdb1:~$ srvctl stop database -d cams oracle@cwgsdb1:~$ srvctl start database -d cams -o mount oracle@cwgsdb1:~$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 25 20:13:32 2018 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> alter database noarchivelog; Database altered. SQL> alter database open; Database altered. SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination +DATADG Oldest online log sequence 3 Current log sequence 6 另一個節點也執行: SQL> alter database open; Database altered. SQL> select open_mode from gv$database; OPEN_MODE -------------------- READ WRITE READ WRITE
檢查數據庫狀態
grid@cwgsdb1:~$ crsctl stat res -t-------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATADG.dg ONLINE ONLINE cwgsdb1 ONLINE ONLINE cwgsdb2 ora.LISTENER.lsnr ONLINE ONLINE cwgsdb1 ONLINE ONLINE cwgsdb2 ora.SYSTEMDG.dg ONLINE ONLINE cwgsdb1 ONLINE ONLINE cwgsdb2 ora.asm ONLINE ONLINE cwgsdb1 Started ONLINE ONLINE cwgsdb2 Started ora.gsd OFFLINE OFFLINE cwgsdb1 OFFLINE OFFLINE cwgsdb2 ora.net1.network ONLINE ONLINE cwgsdb1 ONLINE ONLINE cwgsdb2 ora.ons ONLINE ONLINE cwgsdb1 ONLINE ONLINE cwgsdb2 ora.registry.acfs ONLINE ONLINE cwgsdb1 ONLINE ONLINE cwgsdb2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE cwgsdb2 ora.cams.db 1 ONLINE ONLINE cwgsdb1 Open 2 ONLINE ONLINE cwgsdb2 Open ora.cvu 1 ONLINE ONLINE cwgsdb1 ora.cwgsdb1.vip 1 ONLINE ONLINE cwgsdb1 ora.cwgsdb2.vip 1 ONLINE ONLINE cwgsdb2 ora.oc4j 1 ONLINE ONLINE cwgsdb1 ora.scan1.vip 1 ONLINE ONLINE cwgsdb2
(1)解壓最新生產數據
oracle@cwgsdb1:~$ cd oracle@cwgsdb1:~$ cd /u01/app/oracle/dump/ oracle@cwgsdb1:/u01/app/oracle/dump$ ls camsData20181025.tar.gz oracle@cwgsdb1:/u01/app/oracle/dump$ tar zxvf camsData20181025.tar.gz x camsData20181025.dmp, 7310499840 bytes, 14278320 tape blocks x camsData20181025.log, 345007 bytes, 674 tape blocks
(2)執行導入命令
impdp \'/ as sysdba\' DIRECTORY=dpdata1 DUMPFILE=camsData20181025.dmp SCHEMAS=xxxx,yyyy logfile=impdp_camsData20181025.log cluster=N
(注:這里需要和開發人員確認,確認后刪除)
drop FUNCTION "DATABUFF"."ELEMIDX";drop FUNCTION "DB2ODESK"."FSBN"; drop PROCEDURE "DB2ODESK"."BATCH_DELETE"; drop PROCEDURE "DB2ODESK"."SP_DESK_CURRZS"; drop PACKAGE BODY "DATABUFF"."MIGRATION_TRANSFORMER"; drop FUNCTION "CAMS_BCE"."TX_ZD2"; drop FUNCTION "CAMS_BCE"."TX_ZD3";
oracle@cwgsdb1:/u01/app/oracle/dump$ srvctl stop database -d cams oracle@cwgsdb1:/u01/app/oracle/dump$ srvctl start database -d cams -o mount oracle@cwgsdb1:/u01/app/oracle/dump$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 25 20:52:54 2018 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> alter database archivelog; Database altered. SQL> alter database open; Database altered. SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination +DATADG Oldest online log sequence 4 Next log sequence to archive 7 Current log sequence 7 另一個節點也執行: SQL> alter database open; Database altered. SQL> select open_mode from gv$database; OPEN_MODE -------------------- READ WRITE READ WRITE
按照測試環境驗證過的流程,部署生產環境RAMN策略,并執行手工全量備份。
exec dbms_stats.gather_schema_stats('XXXX');
按照測試環境驗證過的流程,修改生產應用中數據庫連接為service連接
(注:生產系統使用查詢交易進行驗證)
按順序依次啟動應用,測試多組跨子系統的查詢交易,然后在數據總線監控平臺上查看交易的報文以及成功狀態。
(注:如果遇到問題,需第一時間處理)
生產環境執行跑批操作,將會計日期跑到第二日,同時驗證功能是否正常。
(這里選擇現有用戶scott作為插敘用戶,只賦予查詢權限)
由于測試階段已經將scott用戶解鎖,這里不再重復操作。
select 'grant select on XXXX.' || OBJECT_NAME || ' to scott;' from DBA_OBJECTS where owner='XXXX' and object_type in ('TABLE','VIEW');
執行上述語句生成的SQL,可為scott用戶賦予查詢所有業務表和視圖的權限。
登陸電票前置機weblogic控制臺,通過控制臺開啟電票前置機應用。
(1)由于遷移時遇到ORA-04063: view "CAMS_CWAP.QUERYSHOUXIN_V" 有錯誤的問題,為保證數據表、視圖權限完整性,單獨執行報表權限腳本。
(2)Linux和Unix系統中date命令不一樣,遷移后需單獨調整。
(3)Linux和Unix系統中nc命令不一樣,遷移后需單獨調整。
(4)測試過程發現新生產數據庫與測試環境未進行網絡隔離,存在一定風險。已通知網絡工程師處理。
經過確認,RMAN已經按照既定策略執行備份和歷史文件刪除,生產環境運行穩定。
至此,生產環境切換工作全部完成完畢,生產環境Oracle數據庫成功從Linux X86單機遷移到Solaries雙節點RAC集群。
到此,相信大家對“Oracle數據庫怎么從Linux x86單機遷移到Solaries雙節點RAC集群”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。