本篇内容主要讲解“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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。