欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

通过辅助库(Auxiliary)做ASM迁移案例

程序员文章站 2024-01-20 08:10:40
...

通过辅助库(Auxiliary)做ASM迁移案例系统环境:操作系统:RedHatEL55Oracle:Oracle10gR2通过辅助库建立ASM迁移,可以很方便将文件系统的存储异机迁移;并且可

通过辅助库(Auxiliary)做ASM迁移案例

系统环境:

操作系统:RedHat EL55

Oracle : Oracle 10gR2


通过辅助库建立ASM迁移,可以很方便将文件系统的存储异机迁移;并且可减少数据库的停机时间,本案例为测试案例,,目标库和辅助库都在同一台机器上。

1、建立ASM实例

[oracle@rh55 ~]$export ORACLE_SID=+ASM

[oracle@rh55 ~]$sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 29 11:39:49 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

11:39:50 SYS@ +ASM>startup nomount

ASM instance started

Total System Global Area 83886080 bytes

Fixed Size 1217836 bytes

Variable Size 57502420 bytes

ASM Cache 25165824 bytes

11:39:57 SYS@ +ASM>select name ,state from v$asm_diskgroup;

NAME STATE

------------------------------ -----------

DG1 DISMOUNTED

RCY1 DISMOUNTED

Elapsed: 00:00:00.24

11:40:14 SYS@ +ASM>alter diskgroup dg1 mount;

Diskgroup altered.

Elapsed: 00:00:04.88

11:40:29 SYS@ +ASM>alter diskgroup rcy1 mount;

Diskgroup altered.

Elapsed: 00:00:04.77

2、建立并配置辅助库

Target DB:test1

Auxiliary DB: test1asm

11:41:58 SYS@ test1>show parameter name

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_name string test1

db_unique_name string test1

global_names boolean FALSE

instance_name string test1

service_names string test1

11:42:06 SYS@ test1>show parameter spfile

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

spfile string /u01/app/oracle/product/10.2.0

/db_1/dbs/spfiletest1.ora

11:42:11 SYS@ test1>create pfile from spfile;

File created.


建立辅助库初始化参数文件:

[oracle@rh55 dbs]$cp inittest1.ora inittest1asm.ora

[oracle@rh55 dbs]$ cat inittest1asm.ora

*.background_dump_dest='$ORACLE_BASE/admin/test1asm/bdump'

*.control_files='+dg1/test1asm/controlfile/control01.ctl'

*.core_dump_dest='$ORACLE_BASE/admin/test1asm/cdump'

*.db_block_size=8192

*.db_cache_size=30M#DEMO

*.db_file_multiblock_read_count=16

*.db_name='test1asm'

*.instance_name='test1asm'

*.log_archive_dest_1='location=+rcy1'

*.log_archive_format='arch_%t_%s_%r.log'

*.optimizer_mode='choose'

*.parallel_threads_per_cpu=4#SMALL

*.pga_aggregate_target=30M#DEMO

*.query_rewrite_enabled='true'

*.query_rewrite_integrity='trusted'

*.sga_target=240M

*.shared_pool_size=20M#DEMO

*.star_transformation_enabled='true'

*.undo_management='auto'

*.undo_tablespace='undotbs1'

*.user_dump_dest='$ORACLE_BASE/admin/test1asm/udump'

*.db_create_file_dest='+DG1'

*.db_file_name_convert=("/u01/app/oracle/oradata/test1","+dg1/test1asm/datafile","/u01/app/oracle/oradata/test1","+dg1/test1asm/tempfile")

*.log_file_name_convert=("/u01/app/oracle/oradata/test1","+dg1/test1asm/onlinelog")

db_recovery_file_dest='+rcy1'

db_recovery_file_dest_size=2g

*.audit_file_dest='$ORACLE_BASE/admin/test1asm/adump'/bdump

建立辅助库相关目录:

[oracle@rh55 dbs]$ mkdir -p $ORACLE_BASE/admin/test1asm/cdump

[oracle@rh55 dbs]$ mkdir -p $ORACLE_BASE/admin/test1asm/udump

[oracle@rh55 dbs]$ mkdir -p $ORACLE_BASE/admin/test1asm/adump

建立口令文件:

[oracle@rh55 dbs]$ orapwd file=orapwtest1asm password=oracle entries=3

建立tnsnames文件:

[oracle@rh55 admin]$ cat tnsnames.ora

TEST1ASM =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = rh55)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = test1asm)

( UR = A )

)

)

TEST1 =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = rh55)(PORT = 1521))

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = test1)

)

)

3、迁移文件系统到ASM存储

对目标库备份:

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/disk2/bak/test1/auto_ctl_%d_%F';

RMAN> run{

2> shutdown immediate;

3> startup force mount;

4> allocate channel ch1 device type disk;

5> backup as compressed backupset database format '/disk2/bak/test1/%d_%s.bak'

6> plus archivelog format '/disk2/bak/test1/arch_%U.bak'

7> tag='full_log';

8> release channel ch1;}

启动辅助库实例:

[oracle@rh55 dbs]$export ORACLE_SID=test1asm

[oracle@rh55 dbs]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 29 12:17:22 2014

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to an idle instance.

12:17:22 SYS@ test1asm>startup nomount;

ORACLE instance started.

Total System Global Area 251658240 bytes

Fixed Size 1218796 bytes

Variable Size 58722068 bytes

Database Buffers 188743680 bytes

Redo Buffers 2973696 bytes

15:47:09 SYS@ test1asm>show parameter name

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

db_file_name_convert string /u01/app/oracle/oradata/test1,