单实例数据库迁移到rac环境(三)

简介:

在前两节中,分别介绍了使用expdp/impdp迁移单实例数据库到rac环境的方法,其中包括使用表空间传输的方式,但如果在用户数量多,或者表空间数量多,又或者函数,过程,包等代码对象多的条件下,使用前两种方式迁移未免麻烦且费时,因而在本节中将简要的介绍下使用rman备份的异机恢复来实现迁移单实例数据库到rac环境,这种方式美中不足的地方是数据库需要以open resetlogs方式打开,意味着对数据库做不完全恢复,可能会丢失少量的数据!

环境介绍:
数据库的版本均为10.2.0.5,数据库字符集编码为utf8
操作系统的版本单实例数据库(源库)为rhel5.4 64 bit 数据库名:orcl.yang.com 实例名:orcl
rac(目标数据库)为ceontos4.8 64bit

一:目标数据库准备工作,rman备份的异机恢复要求数据库名要一致,因而需要先删掉原有的racdb数据库和数据文件

[oracle@rac1 ~]$ srvctl stop database -d racdb -o immediate
[oracle@rac1 ~]$ srvctl remove database -d racdb 
Remove the database racdb? (y/[n]) y

[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1        
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2

节点2上同样需要修改/etc/oratab文件
[root@rac1 ~]# tail -n 1 /etc/oratab 
+ASM1:/u01/app/oracle/product/10.2.0/db_1:N  

[oracle@rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@rac1 ~]$ asmcmd
ASMCMD> rm -rf +DATA/RACDB
ASMCMD> rm -rf +FRA/RACDB

[oracle@rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 3 12:43:13 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected.

SQL> col state format a10
SQL> col name format a15
SQL> col failgroup format a20  
SQL> set line 200
SQL> select  state,redundancy,total_mb,free_mb,name,failgroup from v$asm_disk;

STATE      REDUNDANCY              TOTAL_MB    FREE_MB NAME            FAILGROUP
---------- --------------------- ---------- ---------- --------------- --------------------
NORMAL     UNKNOWN                      286          0
NORMAL     UNKNOWN                      286          0
NORMAL     UNKNOWN                      286          0
NORMAL     UNKNOWN                      286          0
NORMAL     UNKNOWN                      286          0
NORMAL     UNKNOWN                    10208      10114 FRA_0000        FRA_0000
NORMAL     UNKNOWN                     9537       9443 DATA_0001       DATA_0001
NORMAL     UNKNOWN                     9537       9443 DATA_0000       DATA_0000
8 rows selected.

备注:前5个磁盘分别为表决盘和ocr,data磁盘组做了normal冗余

SQL> select  group_number,name,state,type,total_mb,free_mb,unbalanced  from v$asm_diskgroup;

GROUP_NUMBER NAME            STATE      TYPE                 TOTAL_MB    FREE_MB UNB
------------ --------------- ---------- ------------------ ---------- ---------- ---
           1 DATA            MOUNTED    NORMAL                  19074      18886 N
           2 FRA             MOUNTED    EXTERN                  10208      10114 N

二:源库上建一个测试表,由spfile生成pfile

SQL> show parameter name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
db_name                              string      orcl
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      orcl
lock_name_space                      string
log_file_name_convert                string
service_names                        string      orcl.yang.com

SQL> create table test1.migrate(a varchar2(20));
Table created.

SQL> insert into test1.migrate a values ('successful');
1 row created.

SQL> commit;
Commit complete.

SQL> create pfile='/home/oracle/rman_bak/initorcl.ora' from spfile;
File created.

SQL> select file_id,file_name,tablespace_name from dba_data_files order by 1;

   FILE_ID FILE_NAME                                          TABLESPACE_NAME
---------- -------------------------------------------------- ---------------
         1 /u01/app/oracle/oradata/orcl/system01.dbf          SYSTEM
         2 /u01/app/oracle/oradata/orcl/undotbs01.dbf         UNDOTBS1
         3 /u01/app/oracle/oradata/orcl/sysaux01.dbf          SYSAUX
         4 /u01/app/oracle/oradata/orcl/users01.dbf           USERS
         5 /u01/app/oracle/oradata/orcl/example01.dbf         EXAMPLE
         6 /u01/app/oracle/oradata/orcl/exp_rac01.dbf         EXP_RAC
         7 /u01/app/oracle/oradata/orcl/exp_rac_index01.dbf   EXP_RAC_INDEX
         8 /u01/app/oracle/oradata/orcl/exp_rac1_01.dbf       EXP_RAC1
         9 /u01/app/oracle/oradata/orcl/exp_rac1_index_01.dbf EXP_RAC1_INDEX
9 rows selected.

SQL> select file_id,file_name,tablespace_name from dba_temp_files order by 1;

   FILE_ID FILE_NAME                                          TABLESPACE_NAME
---------- -------------------------------------------------- ---------------
         1 /u01/app/oracle/oradata/orcl/temp01.dbf            TEMP

SQL> select file_name,tablespace_name from dba_temp_files;

FILE_NAME                                          TABLESPACE_NAME
-------------------------------------------------- --------------------
/u01/app/oracle/oradata/orcl/temp01.dbf            TEMP

三:在源库上使用rman进行全库备份,并将备份复制到目标数据库上

[oracle@server49 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Jan 3 12:10:06 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: ORCL (DBID=1299224612)

RMAN> backup incremental level 0 
2> format '/home/oracle/rman_bak/orcl_%U'
3> database plus archivelog
4> delete all input;

RMAN> backup current controlfile format '/home/oracle/rman_bak/migrate.ctl';

RMAN> list backup of database summary;

List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
2       B  0  A DISK        03-JAN-12       1       1       NO         TAG20120103T121503

[oracle@server49 ~]$ scp -rp /home/oracle/rman_bak/ rac1:/home/oracle/

四:在目标数据库上执行恢复
4.1 修改初始化参数文件如下

[oracle@rac1 ~]$ cat /home/oracle/rman_bak/initorcl.ora 
*.__db_cache_size=79691776
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__shared_pool_size=109051904
*.__streams_pool_size=8388608
orcl1.instance_name='orcl1'
orcl2.instance_name='orcl2'
orcl1.instance_number=1
orcl2.instance_number=2
*.cluster_database=true
*.cluster_database_instances=2
orcl1.thread=1
*.compatible='10.2.0.5.0'
*.control_files='+DATA/orcl/controlfile/control01.ctl','+FRA/orcl/controlfile/control02.ctl'
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'
*.db_block_size=8192
*.db_domain='yang.com'
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_recovery_file_dest='+FRA'
*.db_recovery_file_dest_size=21474836480
*.log_archive_dest_1='LOCATION=+FRA/orcl/archivelog'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_format='%t_%s_%r.arc'
*.open_cursors=300
*.pga_aggregate_target=71303168
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=213909504
*.undo_management='AUTO'
orcl1.undo_tablespace='UNDOTBS1'
orcl2.undo_tablespace='UNDOTBS2'

备注:需要格外注意的是,这个时候不能加orcl2.thread=2参数,否则后面无法将数据库启动到mount状态

4.2 创建相关的目录,两个节点上都应该存在相应的目录和密码文件

[oracle@rac1 ~]$ mkdir -p  /u01/app/oracle/admin/orcl/{adump,bdump,cdump,udump}
[oracle@rac1 ~]$ cd $ORACLE_HOME/dbs
[oracle@rac1 dbs]$ echo 'spfile=+DATA/ORCL/PARAMETERFILE/spfileorcl.ora' > initorcl1.ora
[oracle@rac1 dbs]$ orapwd file=orapworcl1 password=123456
[oracle@rac2 ~]$ cd $ORACLE_HOME/dbs
[oracle@rac2 dbs]$ echo 'spfile=+DATA/ORCL/PARAMETERFILE/spfileorcl.ora' > initorcl2.ora
[oracle@rac2 dbs]$ orapwd file=orapworcl1 password=123456

4.3 利用pfile生成spfile,并保存在ASM实例上,ASM磁盘组中需要存在相应的目录,否则将报错!

[oracle@rac1 ~]$ export ORACLE_SID=orcl1
[oracle@rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 3 13:00:10 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected to an idle instance.

SQL> startup nomount pfile='/home/oracle/rman_bak/initorcl.ora';
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size             125831120 bytes
Database Buffers           79691776 bytes
Redo Buffers                6291456 bytes

SQL> create spfile='+DATA/ORCL/PARAMETERFILE/spfileorcl.ora' from pfile='/home/oracle/rman_bak/initorcl.ora';
File created.

ASMCMD> pwd
+DATA/ORCL/PARAMETERFILE
ASMCMD> ls
spfileorcl.ora

SQL> shutdown abort;
ORACLE instance shut down.

4.4 将节点1数据库启动到nomount状态,恢复控制文件,重新将数据库启动到mount状态

[oracle@rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jan 3 13:09:48 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size             125831120 bytes
Database Buffers           79691776 bytes
Redo Buffers                6291456 bytes

[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Jan 3 13:15:05 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: orcl (not mounted)
RMAN> restore controlfile from '/home/oracle/rman_bak/migrate.ctl';

Starting restore at 2012-01-03 13:15:11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=153 instance=orcl1 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:08
output filename=+DATA/orcl/controlfile/control01.ctl
output filename=+FRA/orcl/controlfile/control02.ctl
Finished restore at 2012-01-03 13:15:19

[oracle@rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@rac1 ~]$ asmcmd
ASMCMD> pwd
+data/orcl/controlfile
ASMCMD> ls
control01.ctl
current.263.771599715
ASMCMD> cd +fra/orcl/controlfile
ASMCMD> ls
control02.ctl
current.260.771599717

SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size             125831120 bytes
Database Buffers           79691776 bytes
Redo Buffers                6291456 bytes
Database mounted.

SQL> select host_name,status,thread# from gv$instance;

HOST_NAME            STATUS                  THREAD#
-------------------- -------------------- ----------
rac1.yang.com        MOUNTED                       1

4.5 使用rman进行数据库恢复操作

[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Tue Jan 3 17:29:22 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: ORCL (DBID=1299224612, not open)

RMAN> run {
2> set newname for datafile 1 to '+DATA/orcl/datafile/system01.dbf';
3> set newname for datafile 2 to '+DATA/orcl/datafile/undotbs01.dbf';
4> set newname for datafile 3 to '+DATA/orcl/datafile/sysaux01.dbf';
5> set newname for datafile 4 to '+DATA/orcl/datafile/users01.dbf';
6> set newname for datafile 5 to '+DATA/orcl/datafile/example01.dbf';
7> set newname for datafile 6 to '+DATA/orcl/datafile/exp_rac01.dbf';
8> set newname for datafile 7 to '+DATA/orcl/datafile/exp_rac_index01.dbf';
9> set newname for datafile 8 to '+DATA/orcl/datafile/exp_rac1_01.dbf';
10> set newname for datafile 9 to '+DATA/orcl/datafile/exp_rac1_index_01.dbf';
11> set newname for tempfile 1 to '+DATA/orcl/tempfile/temp01.dbf';
12> restore database;
13> switch datafile all;
14> switch tempfile all;
15> }

RMAN> report schema;

RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    440      SYSTEM               ***     +DATA/orcl/datafile/system01.dbf
2    30       UNDOTBS1             ***     +DATA/orcl/datafile/undotbs01.dbf
3    250      SYSAUX               ***     +DATA/orcl/datafile/sysaux01.dbf
4    5        USERS                ***     +DATA/orcl/datafile/users01.dbf
5    100      EXAMPLE              ***     +DATA/orcl/datafile/example01.dbf
6    410      EXP_RAC              ***     +DATA/orcl/datafile/exp_rac01.dbf
7    300      EXP_RAC_INDEX        ***     +DATA/orcl/datafile/exp_rac_index01.dbf
8    300      EXP_RAC1             ***     +DATA/orcl/datafile/exp_rac1_01.dbf
9    300      EXP_RAC1_INDEX       ***     +DATA/orcl/datafile/exp_rac1_index_01.dbf

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    0        TEMP                 32767       +DATA/orcl/tempfile/temp01.dbf

ASMCMD> pwd
+data/orcl/datafile
ASMCMD> ls
EXAMPLE.268.771620011
EXP_RAC.260.771620003
EXP_RAC1.262.771620007
EXP_RAC1_INDEX.266.771620007
EXP_RAC_INDEX.261.771620003
SYSAUX.267.771620009
SYSTEM.297.771619999
UNDOTBS1.305.771620015
USERS.309.771620065
example01.dbf
exp_rac01.dbf
exp_rac1_01.dbf
exp_rac1_index_01.dbf
exp_rac_index01.dbf
sysaux01.dbf
system01.dbf
undotbs01.dbf
users01.dbf

RMAN> recover database;
Starting recover at 2012-01-03 18:59:41
using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=20
channel ORA_DISK_1: reading from backup piece /home/oracle/rman_bak/orcl_09mvru2e_1_1
channel ORA_DISK_1: restored backup piece 1
piece handle=/home/oracle/rman_bak/orcl_09mvru2e_1_1 tag=TAG20120103T183453
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
archive log filename=+FRA/orcl/archivelog/1_20_771443882.arc thread=1 sequence=20
unable to find archive log
archive log thread=1 sequence=21
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/03/2012 18:59:47
RMAN-06054: media recovery requesting unknown log: thread 1 seq 21 lowscn 479325

4.6 对在线重做日志文件进行更名,添加thread 2日志组

SQL> select group#,member from v$logfile;

    GROUP# MEMBER
---------- ----------------------------------------
         3 /u01/app/oracle/oradata/orcl/redo03.log
         2 /u01/app/oracle/oradata/orcl/redo02.log
         1 /u01/app/oracle/oradata/orcl/redo01.log

SQL> alter database rename file '/u01/app/oracle/oradata/orcl/redo01.log' to '+DATA/orcl/onlinelog/redo01.dbf';
Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/orcl/redo02.log' to '+DATA/orcl/onlinelog/redo02.dbf';
Database altered.

SQL> alter database rename file '/u01/app/oracle/oradata/orcl/redo03.log' to '+DATA/orcl/onlinelog/redo03.dbf';
Database altered.

SQL> alter database add logfile thread 2 group 4 '+DATA' size 50M;
Database altered.

SQL> alter database add logfile thread 2 group 5 '+DATA' size 50M;
Database altered.

SQL> alter database add logfile thread 2 group 6 '+DATA' size 50M;
Database altered.

SQL> select thread#,bytes/(1024*1024),status from v$log;

   THREAD# BYTES/(1024*1024) STATUS
---------- ----------------- ------------------------------------------------
         1                50 INACTIVE
         1                50 ACTIVE
         1                50 CURRENT
         2                50 UNUSED
         2                50 UNUSED
         2                50 UNUSED

6 rows selected.

4.7 使用open resetlogs方式打开数据库

SQL> recover database using backup controlfile until cancel;
ORA-00279: change 479325 generated at 01/03/2012 18:34:52 needed for thread 1
ORA-00289: suggestion : +FRA/orcl/archivelog/1_21_771443882.arc
ORA-00280: change 479325 for thread 1 is in sequence #21

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
Media recovery cancelled.

SQL> alter database open resetlogs;
Database altered.

SQL> select open_mode,name from gv$database;

OPEN_MODE                      NAME
------------------------------ ---------------------------
READ WRITE                     ORCL

SQL> select comp_name,version,status from dba_registry;

COMP_NAME                      VERSION              STATUS
------------------------------ -------------------- --------------------
Oracle Database Catalog Views  10.2.0.5.0           VALID
Oracle Database Packages and T 10.2.0.5.0           VALID
ypes

Oracle Workspace Manager       10.2.0.5.0           VALID
JServer JAVA Virtual Machine   10.2.0.5.0           VALID
Oracle XDK                     10.2.0.5.0           VALID
Oracle Database Java Packages  10.2.0.5.0           VALID
Oracle Expression Filter       10.2.0.5.0           VALID
Oracle Data Mining             10.2.0.5.0           VALID
Oracle Text                    10.2.0.5.0           VALID

COMP_NAME                      VERSION              STATUS
------------------------------ -------------------- --------------------
Oracle XML Database            10.2.0.5.0           VALID
Oracle Rules Manager           10.2.0.5.0           VALID
Oracle interMedia              10.2.0.5.0           VALID
OLAP Analytic Workspace        10.2.0.5.0           VALID
Oracle OLAP API                10.2.0.5.0           VALID
OLAP Catalog                   10.2.0.5.0           VALID
Spatial                        10.2.0.5.0           VALID
Oracle Enterprise Manager      10.2.0.5.0           VALID

4.8 修改相关的初始化参数,创建undotbs2表空间,启用thread 2日志组

SQL> alter system set thread=1 scope=spfile sid='orcl1';
System altered.

SQL> alter system set thread=2 scope=spfile sid='orcl2';
System altered.

SQL> select bytes/(1024*1024) MB from dba_data_files where tablespace_name='UNDOTBS1';

        MB
----------
        30

SQL> create undo tablespace undotbs2 datafile '+DATA/ORCL/DATAFILE/undotbs02.dbf' size 30M;
Tablespace created.

SQL> alter system set undo_tablespace=undotbs2 sid='orcl2';
System altered.

SQL> alter database enable thread 2;
Database altered.

4.9 重新启动节点1数据库实例后,再启动节点2数据库实例;并验证结果

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size             125831120 bytes
Database Buffers           79691776 bytes
Redo Buffers                6291456 bytes
Database mounted.
Database opened.

SQL> select instance_number,instance_name,host_name ,status from gv$instance;

INSTANCE_NUMBER INSTANCE_NAME        HOST_NAME            STATUS
--------------- -------------------- -------------------- --------------------
              1 orcl1                rac1.yang.com        OPEN
              2 orcl2                rac2.yang.com        OPEN

SQL> select * from test1.migrate;

A
------------------------------------------------------------
successful

SQL> col file_name format a40
SQL> col tablespace_name format a20
SQL> select file_id,file_name,tablespace_name from dba_data_files order by 1;

   FILE_ID FILE_NAME                                TABLESPACE_NAME
---------- ---------------------------------------- --------------------
         1 +DATA/orcl/datafile/system01.dbf         SYSTEM
         2 +DATA/orcl/datafile/undotbs01.dbf        UNDOTBS1
         3 +DATA/orcl/datafile/sysaux01.dbf         SYSAUX
         4 +DATA/orcl/datafile/users01.dbf          USERS
         5 +DATA/orcl/datafile/example01.dbf        EXAMPLE
         6 +DATA/orcl/datafile/exp_rac01.dbf        EXP_RAC
         7 +DATA/orcl/datafile/exp_rac_index01.dbf  EXP_RAC_INDEX
         8 +DATA/orcl/datafile/exp_rac1_01.dbf      EXP_RAC1
         9 +DATA/orcl/datafile/exp_rac1_index_01.db EXP_RAC1_INDEX
           f


   FILE_ID FILE_NAME                                TABLESPACE_NAME
---------- ---------------------------------------- --------------------
        10 +DATA/orcl/datafile/undotbs02.dbf        UNDOTBS2

五:收尾工作

SQL> @$ORACLE_HOME/rdbms/admin/catclust.sql;
[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1        
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2      

[oracle@rac1 ~]$ srvctl add database -d orcl -o $ORACLE_HOME 
[oracle@rac1 ~]$ srvctl add instance -d orcl -i orcl1 -n rac1
[oracle@rac1 ~]$ srvctl add instance -d orcl -i orcl2 -n rac2

[oracle@rac1 ~]$ srvctl stop database -d orcl -o immediate
[oracle@rac1 ~]$ srvctl start database -d orcl
[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host        
----------------------------------------------------------------------
ora.orcl.db    application    0/0    0/1    ONLINE    ONLINE    rac1        
ora....l1.inst application    0/5    0/0    ONLINE    ONLINE    rac1        
ora....l2.inst application    0/5    0/0    ONLINE    ONLINE    rac2        
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1        
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2  

参考文章:http://blog.csdn.net/tianlesoftware/article/details/6432415(感谢作者分享!)

本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/757779如需转载请自行联系原作者


ylw6006

相关文章
|
2月前
|
SQL 关系型数据库 MySQL
SQL命令行退出操作指南:轻松掌握不同数据库环境下的退出技巧
在数据库管理与开发过程中,经常需要通过SQL命令行工具(如MySQL的mysql客户端、PostgreSQL的psql、SQL Server的sqlcmd等)与数据库进行交互
365 59
|
5天前
|
弹性计算 关系型数据库 数据库
自建数据库迁移到云数据库实操
本课程详细介绍了自建数据库迁移到阿里云RDS的实操步骤。主要内容包括:创建实例资源、安全设置、配置自建的MySQL数据库、数据库的迁移、从自建数据库切换到RDS以及清理资源。通过这些步骤,学员可以掌握如何将自建数据库安全、高效地迁移到云端,并确保应用的正常运行。
51 26
|
21天前
|
弹性计算 安全 关系型数据库
活动实践 | 自建数据库迁移到云数据库
通过阿里云RDS,用户可获得稳定、安全的企业级数据库服务,无需担心数据库管理与维护。该方案使用RDS确保数据库的可靠性、可用性和安全性,结合ECS和DTS服务,实现自建数据库平滑迁移到云端,支持WordPress等应用的快速部署与运行。通过一键部署模板,用户能迅速搭建ECS和RDS实例,完成数据迁移及应用上线,显著提升业务灵活性和效率。
|
5天前
|
运维 关系型数据库 MySQL
自建数据库迁移到云数据库RDS
本次课程由阿里云数据库团队的凡珂分享,主题为自建数据库迁移至云数据库RDS MySQL版。课程分为四部分:1) 传统数据库部署方案及痛点;2) 选择云数据库RDS MySQL的原因;3) 数据库迁移方案和产品选型;4) 线上活动与权益。通过对比自建数据库的局限性,介绍了RDS MySQL在可靠性、安全性、性价比等方面的优势,并详细讲解了使用DTS(数据传输服务)进行平滑迁移的步骤。此外,还提供了多种优惠活动信息,帮助用户降低成本并享受云数据库带来的便利。
|
1月前
|
消息中间件 资源调度 关系型数据库
如何在Flink on YARN环境中配置Debezium CDC 3.0,以实现实时捕获数据库变更事件并将其传输到Flink进行处理
本文介绍了如何在Flink on YARN环境中配置Debezium CDC 3.0,以实现实时捕获数据库变更事件并将其传输到Flink进行处理。主要内容包括安装Debezium、配置Kafka Connect、创建Flink任务以及启动任务的具体步骤,为构建实时数据管道提供了详细指导。
87 9
|
1月前
|
关系型数据库 MySQL Linux
Linux环境下MySQL数据库自动定时备份实践
数据库备份是确保数据安全的重要措施。在Linux环境下,实现MySQL数据库的自动定时备份可以通过多种方式完成。本文将介绍如何使用`cron`定时任务和`mysqldump`工具来实现MySQL数据库的每日自动备份。
101 3
|
1月前
|
监控 关系型数据库 MySQL
Linux环境下MySQL数据库自动定时备份策略
在Linux环境下,MySQL数据库的自动定时备份是确保数据安全和可靠性的重要措施。通过设置定时任务,我们可以每天自动执行数据库备份,从而减少人为错误和提高数据恢复的效率。本文将详细介绍如何在Linux下实现MySQL数据库的自动定时备份。
46 3
|
20天前
|
安全 关系型数据库 MySQL
体验自建数据库迁移到云数据库RDS,领取桌面置物架!
「技术解决方案【Cloud Up 挑战赛】」正式开启!本方案旨在帮助用户将自建数据库平滑迁移至阿里云RDS MySQL,享受稳定、高效、安全的数据库服务,助力业务快速发展。完成指定任务即可赢取桌面置物架等奖励,限量供应,先到先得。活动时间:2024年12月3日至12月31日16点。
|
2月前
|
算法 大数据 数据库
云计算与大数据平台的数据库迁移与同步
本文详细介绍了云计算与大数据平台的数据库迁移与同步的核心概念、算法原理、具体操作步骤、数学模型公式、代码实例及未来发展趋势与挑战。涵盖全量与增量迁移、一致性与异步复制等内容,旨在帮助读者全面了解并应对相关技术挑战。
56 3
|
3月前
|
存储 SQL 关系型数据库
一篇文章搞懂MySQL的分库分表,从拆分场景、目标评估、拆分方案、不停机迁移、一致性补偿等方面详细阐述MySQL数据库的分库分表方案
MySQL如何进行分库分表、数据迁移?从相关概念、使用场景、拆分方式、分表字段选择、数据一致性校验等角度阐述MySQL数据库的分库分表方案。
521 15
一篇文章搞懂MySQL的分库分表,从拆分场景、目标评估、拆分方案、不停机迁移、一致性补偿等方面详细阐述MySQL数据库的分库分表方案