本篇内容主要讲解“Oracle数据库怎么从Linux x86单机迁移到Solaries双节点RAC集群”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Oracle数据库怎么从Linux x86单机迁移到Solaries双节点RAC集群”吧!
1.清理RAC集群中测试数据
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 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
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/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
4.在第RAC第一个节点调整directory路径,指向NFS文件系统
(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
5.测试新directory备份权限
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
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
scp camsData20181025.tar.gz oracle@100.100.100.215:/u01/app/oracle/dump
$ lsnrctl stop $ sqlplus / as sysdba sql> shutdown immediate;
(5)关闭定时任务,在任务之前加#
crontab -e
10.修改RAC集群的scan ip为生产数据库IP
按照测试环境验证过的流程,修改RAC集群的scan ip为生产数据库IP。
11.关闭生产环境归档
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
12.还原最新生产数据
(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
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 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
15.部署生产环境RMAN策略,并执行全量备份
按照测试环境验证过的流程,部署生产环境RAMN策略,并执行手工全量备份。
16.手工收集统计信息
exec dbms_stats.gather_schema_stats('XXXX');
17.修改生产应用中数据库连接为service连接
按照测试环境验证过的流程,修改生产应用中数据库连接为service连接
18.启动生产环境应用并验证
(注:生产系统使用查询交易进行验证)
按顺序依次启动应用,测试多组跨子系统的查询交易,然后在数据总线监控平台上查看交易的报文以及成功状态。
19.验证批量功能
(注:如果遇到问题,需第一时间处理)
生产环境执行跑批操作,将会计日期跑到第二日,同时验证功能是否正常。
20.生产环境数据库查询用户设定
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集群”有了更深的了解,不妨来实际操作一番吧!这里是编程之家网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。