Oracle数据库怎么从Linux x86单机迁移到Solaries双节点RAC集群
本篇内容主要讲解"Oracle数据库怎么从Linux x86单机迁移到Solaries双节点RAC集群",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"Oracle数据库怎么从Linux x86单机迁移到Solaries双节点RAC集群"吧!
1.清理RAC集群中测试数据
(1)关闭应用服务器所有应用
(2)删除数据库中所有用户数据
DROP USER "XXXX" CASCADE;
2.清理RAC集群中RMAN备份文件
oracle@cwgsdb1:~$ rman target /Recovery Manager: Release 11.2.0.4.0 - Production on Thu Oct 25 10:34:39 2018Copyright (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 catalogallocated channel: ORA_DISK_1channel ORA_DISK_1: SID=4048 instance=cams1 device type=DISKList of Backup PiecesBP Key BS Key Pc# Cp# Status Device Type Piece Name------- ------- --- --- ----------- ----------- ----------1 1 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_3.bak2 2 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_4.bak3 3 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1.bak4 4 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_2.bak5 5 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_6.bak6 6 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_7.bak7 7 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_5.bak8 8 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanfullback_cams_20181025_8.bak9 9 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_9.bak10 10 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_10.bak11 11 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-0012 12 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1213 13 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-0114 14 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1415 15 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-0216 16 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-0317 17 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1718 18 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1819 19 1 1 AVAILABLE DISK +DATADG/cams/rman/rmanarch_cams_20181025_1920 20 1 1 AVAILABLE DISK /u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-04Do you really want to delete the above objects (enter YES or NO)? YESdeleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_3.bak RECID=1 STAMP=990407128deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_4.bak RECID=2 STAMP=990407199deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_1.bak RECID=3 STAMP=990407128deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_2.bak RECID=4 STAMP=990407128deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_6.bak RECID=5 STAMP=990407239deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_7.bak RECID=6 STAMP=990407241deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_5.bak RECID=7 STAMP=990407238deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanfullback_cams_20181025_8.bak RECID=8 STAMP=990407287deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_9.bak RECID=9 STAMP=990407292deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_10.bak RECID=10 STAMP=990407292deleted backup piecebackup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-00 RECID=11 STAMP=990407294deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_12 RECID=12 STAMP=990407671deleted backup piecebackup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-01 RECID=13 STAMP=990407673deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_14 RECID=14 STAMP=990414011deleted backup piecebackup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-02 RECID=15 STAMP=990414013deleted backup piecebackup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-03 RECID=16 STAMP=990410565deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_17 RECID=17 STAMP=990414012deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_18 RECID=18 STAMP=990414013deleted backup piecebackup piece handle=+DATADG/cams/rman/rmanarch_cams_20181025_19 RECID=19 STAMP=990414014deleted backup piecebackup piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/c-2649374962-20181025-04 RECID=20 STAMP=990414016Deleted 20 objectsRMAN> list backup;specification does not match any backup in the repository
3.清理RAC集群中逻辑备份文件
(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/dumpSYS DIR_DP /u01/app/oracle/admin/cams/dpdump/
(2)清理directories路径下文件
oracle@cwgsdb1:~$ cd /u01/app/oracle/dumporacle@cwgsdb1:/u01/app/oracle/dump$ lscamsData20181017.dmp camsData20181017.log impdp_camsData20181017.logoracle@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$ lschannel20181024173831.dmp channel20181024173831.log core20181024173831.dmp core20181024173831.log cwap20181024173831.dmp cwap20181024173831.logoracle@cwgsdb1:/u01/app/oracle/admin/cams/dpdump$ rm *oracle@cwgsdb1:/u01/app/oracle/admin/cams/dpdump$ ls
4.在第RAC第一个节点调整directory路径,指向NFS文件系统
(1)该服务器挂载NFS,查看NFS信息:
oracle@cwgsdb1:~$ df -kFilesystem 1024-blocks Used Available Capacity Mounted onrpool/ROOT/solaris 205406208 26547648 100958072 21% //devices 0 0 0 0% /devices/dev 0 0 0 0% /devctfs 0 0 0 0% /system/contractproc 0 0 0 0% /procmnttab 0 0 0 0% /etc/mnttabswap 11726088 2912 11723176 1% /system/volatileobjfs 0 0 0 0% /system/objectsharefs 0 0 0 0% /etc/dfs/sharetabfd 0 0 0 0% /dev/fdrpool/ROOT/solaris/var 205406208 415600 100958072 1% /varswap 11725976 2800 11723176 1% /tmprpool/VARSHARE 205406208 3432 100958072 1% /var/sharerpool/export 205406208 304 100958072 1% /exportrpool/export/home 205406208 320 100958072 1% /export/homerpool/export/home/grid 205406208 1128 100958072 1% /export/home/gridrpool/export/home/oracle 205406208 592 100958072 1% /export/home/oraclerpool/repo 205406208 20656608 100958072 17% /reporpool 205406208 384 100958072 1% /rpoolrpool/VARSHARE/zones 205406208 288 100958072 1% /system/zonesrpool/VARSHARE/pkg 205406208 304 100958072 1% /var/share/pkgrpool/VARSHARE/pkg/repositories 205406208 288 100958072 1% /var/share/pkg/repositories100.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 1692dr-xr-xr-x 2 root root 2 Oct 6 2015 homedrwxr-xr-x 2 root root 2 Sep 28 22:47 mediadrwxr-xr-x 18 root sys 18 Sep 29 06:58 kerneldrwxr-xr-x 7 root sys 23 Sep 29 07:01 platformdrwxr-xr-x 3 root sys 5 Sep 29 07:01 bootlrwxrwxrwx 1 root root 10 Sep 29 07:01 sbin -> ./usr/sbinlrwxrwxrwx 1 root root 9 Sep 29 07:01 bin -> ./usr/bindrwxr-xr-x 2 root sys 2 Sep 29 07:01 mntdrwxr-xr-x 7 root root 7 Sep 29 07:04 systemdrwxr-xr-x 3 root sys 3 Sep 29 07:04 exportdrwxr-xr-x 4 grid oinstall 7 Sep 30 01:49 softdrwxr-xr-x 2 root root 2 Oct 2 01:36 isodrwxr-xr-x 3 root root 15 Oct 2 01:41 repodrwxr-xr-x 12 root bin 335 Oct 2 01:54 libdrwxr-xr-x 43 root sys 50 Oct 2 02:22 vardrwxr-xr-x 4 root root 4 Oct 2 21:02 rpooldrwxr-xr-x 3 root oinstall 3 Oct 2 21:07 u01drwx------ 21 root root 30 Oct 2 23:34 rootdrwxr-xr-x 35 root sys 47 Oct 3 00:12 usrdrwxr-xr-x 2 grid asmadmin 7 Oct 3 04:52 sharediskdrwxr-xr-x 7 root sys 7 Oct 3 07:31 optdrwxr-xr-x 4 root sys 8 Oct 24 01:13 devicesdrwxr-xr-x 193 root sys 193 Oct 24 01:13 devdr-xr-xr-x 1 root root 1 Oct 24 01:14 netdr-xr-xr-x 1 root root 1 Oct 24 01:14 nfs4drwxrwxrwx 2 nobody nobody 4096 Oct 25 14:36 backupdrwxr-xr-x 98 root sys 194 Oct 25 16:40 etcdrwxrwxrwt 10 root sys 862 Oct 25 16:46 tmpdr-xr-xr-x 192 root root 480032 Oct 25 16:47 proc
5.测试新directory备份权限
oracle@cwgsdb1:/backup$ expdp directory=dir_dp schemas=hr dumpfile=hr.dmp logfile=hr.log parallel=2 CLUSTER=NExport: Release 11.2.0.4.0 - Production on Thu Oct 25 17:18:54 2018Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.Username: systemPassword:Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing optionsStarting "SYSTEM"."SYS_EXPORT_SCHEMA_02": system/******** directory=dir_dp schemas=hr dumpfile=hr.dmp logfile=hr.log parallel=2 CLUSTER=NEstimate in progress using BLOCKS method...Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATATotal 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 rowsProcessing object type SCHEMA_EXPORT/USERProcessing object type SCHEMA_EXPORT/SYSTEM_GRANTProcessing object type SCHEMA_EXPORT/ROLE_GRANTProcessing object type SCHEMA_EXPORT/DEFAULT_ROLEProcessing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMAProcessing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCEProcessing object type SCHEMA_EXPORT/TABLE/TABLEProcessing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANTProcessing object type SCHEMA_EXPORT/TABLE/COMMENTProcessing object type SCHEMA_EXPORT/PROCEDURE/PROCEDUREProcessing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDUREProcessing object type SCHEMA_EXPORT/TABLE/INDEX/INDEXProcessing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINTProcessing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICSProcessing object type SCHEMA_EXPORT/VIEW/VIEWProcessing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINTProcessing object type SCHEMA_EXPORT/TABLE/TRIGGERProcessing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICSMaster table "SYSTEM"."SYS_EXPORT_SCHEMA_02" successfully loaded/unloaded******************************************************************************Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_02 is: /backup/hr.dmpJob "SYSTEM"."SYS_EXPORT_SCHEMA_02" successfully completed at Thu Oct 25 17:19:21 2018 elapsed 0 00:00:13
6.原生产环境日结关门
在业务人员完成当日业务后,机构关门,防止业务人员登录系统做业务。计划在数据库迁移完成之后执行日结跑批。
7.原生产环境关闭电票前置机应用
登陆电票前置机weblogic控制台,使用tail -f命令查看当前是否在刷日志,如果没有刷日志,则通过控制台关闭电票前置机应用。
8.原生产环境关闭应用
按照应用关闭的逻辑顺序,依次关闭原生产环境应用。
9.原生产环境数据库备份后下线
(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 sysdbaSQL> shutdown immediate;
(5)关闭定时任务,在任务之前加#
crontab -e
(6)修改旧数据库服务器IP地址为其他地址。
10.修改RAC集群的scan ip为生产数据库IP
按照测试环境验证过的流程,修改RAC集群的scan ip为生产数据库IP。
11.关闭生产环境归档
oracle@cwgsdb1:~$ srvctl stop database -d camsoracle@cwgsdb1:~$ srvctl start database -d cams -o mountoracle@cwgsdb1:~$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 25 20:13:32 2018Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing optionsSQL> alter database noarchivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log list;Database log mode No Archive ModeAutomatic archival DisabledArchive destination +DATADGOldest online log sequence 3Current log sequence 6另一个节点也执行:SQL> alter database open;Database altered.SQL> select open_mode from gv$database;OPEN_MODE--------------------READ WRITEREAD 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
12.还原最新生产数据
(1)解压最新生产数据
oracle@cwgsdb1:~$ cdoracle@cwgsdb1:~$ cd /u01/app/oracle/dump/oracle@cwgsdb1:/u01/app/oracle/dump$ lscamsData20181025.tar.gzoracle@cwgsdb1:/u01/app/oracle/dump$ tar zxvf camsData20181025.tar.gzx camsData20181025.dmp, 7310499840 bytes, 14278320 tape blocksx 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
13.删除导入时提示的无效对象
(注:这里需要和开发人员确认,确认后删除)
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";
14.开启生产环境归档
oracle@cwgsdb1:/u01/app/oracle/dump$ srvctl stop database -d camsoracle@cwgsdb1:/u01/app/oracle/dump$ srvctl start database -d cams -o mountoracle@cwgsdb1:/u01/app/oracle/dump$ sqlplus / as sysdbaSQL*Plus: Release 11.2.0.4.0 Production on Thu Oct 25 20:52:54 2018Copyright (c) 1982, 2013, Oracle. All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,Data Mining and Real Application Testing optionsSQL> alter database archivelog;Database altered.SQL> alter database open;Database altered.SQL> archive log list;Database log mode Archive ModeAutomatic archival EnabledArchive destination +DATADGOldest online log sequence 4Next log sequence to archive 7Current log sequence 7另一个节点也执行:SQL> alter database open;Database altered.SQL> select open_mode from gv$database;OPEN_MODE--------------------READ WRITEREAD WRITE
15.部署生产环境RMAN策略,并执行全量备份
按照测试环境验证过的流程,部署生产环境RAMN策略,并执行手工全量备份。
16.手工收集统计信息
exec dbms_stats.gather_schema_stats('XXXX');
17.修改生产应用中数据库连接为service连接
按照测试环境验证过的流程,修改生产应用中数据库连接为service连接
18.启动生产环境应用并验证
(注:生产系统使用查询交易进行验证)
按顺序依次启动应用,测试多组跨子系统的查询交易,然后在数据总线监控平台上查看交易的报文以及成功状态。
19.验证批量功能
(注:如果遇到问题,需第一时间处理)
生产环境执行跑批操作,将会计日期跑到第二日,同时验证功能是否正常。
20.生产环境数据库查询用户设定
(这里选择现有用户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用户赋予查询所有业务表和视图的权限。
21.开启电票前置机
登陆电票前置机weblogic控制台,通过控制台开启电票前置机应用。
22.其他问题处理
(1)由于迁移时遇到ORA-04063: view "CAMS_CWAP.QUERYSHOUXIN_V" 有错误的问题,为保证数据表、视图权限完整性,单独执行报表权限脚本。
(2)Linux和Unix系统中date命令不一样,迁移后需单独调整。
(3)Linux和Unix系统中nc命令不一样,迁移后需单独调整。
(4)测试过程发现新生产数据库与测试环境未进行网络隔离,存在一定风险。已通知网络工程师处理。
23.隔日检查RMAN备份集,确认生产运行情况
经过确认,RMAN已经按照既定策略执行备份和历史文件删除,生产环境运行稳定。
至此,生产环境切换工作全部完成完毕,生产环境Oracle数据库成功从Linux X86单机迁移到Solaries双节点RAC集群。
到此,相信大家对"Oracle数据库怎么从Linux x86单机迁移到Solaries双节点RAC集群"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!