AIX ORACLE 迁移到ASM
1.准备2块磁盘:hdisk1、hdisk2
2.创建一个vg,加入2块磁盘:smitty mkvg
3.划分2个lv:
# mklv -t jfs2 -y asmlv softvg 200
asmlv
# mklv -t jfs2 -y recoverylv softvg 100;
recoverylv
4.创建asm的pfile. $ORACLE_HOME/dbs/init+ASM.ora
*.background_dump_dest='/u01/oracle/admin/+ASM/bdump' *.core_dump_dest='/u01//oracle/admin/+ASM/cdump' *.user_dump_dest='/u01/oracle/admin/+ASM/udump' *.asm_diskstring='/dev/rasmlv','/dev/rrecoverylv' *.instance_type='asm' *.large_pool_size=12M *.remote_login_passwordfile='exclusive' |
5.修改lv所属权限
# chown oracle:dba /dev/rasmlv # chown oracle:dba /dev/rrecoverylv |
6.创建密码文件
orapwd file=orapw+ASM password=oracle |
7.创建admin目录
oracle@database$mkdir -p /u01/oracle/admin/+ASM/udump oracle@database$mkdir -p /u01/oracle/admin/+ASM/bdump oracle@database$mkdir -p /u01/oracle/admin/+ASM/cdump |
8.启动css进程
SQL> startup
ORA-29701: unable to connect to Cluster Manager
# /u01/oracle/product/10.2.0.1/db_1/bin/localconfig add /etc/oracle does not exist. Creating it now. Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'system'.. Operation successful. Configuration for local CSS has been initialized
Adding to inittab Startup will be queued to init within 30 seconds. Checking the status of new Oracle init process... Expecting the CRS daemons to be up within 600 seconds. CSS is active on these nodes. database CSS is active on all nodes. Oracle CSS service is installed and running under init(1M) # |
9.启动ASM .startup
SQL> startup ASM instance started
Total System Global Area 130023424 bytes Fixed Size 2019136 bytes Variable Size 102838464 bytes ASM Cache 25165824 bytes ORA-15110: no diskgroups mounted |
10.创建asm diskgroup :DATA、RECOVERY
SQL> create diskgroup DATA external redundancy disk '/dev/rasmlv'; Diskgroup created. SQL> create diskgroup RECOVERY external redundancy disk '/dev/rrecoverylv'; Diskgroup created. SQL> select name,state from v$asm_diskgroup;
NAME STATE ---------- ---------------------- DATA MOUNTED RECOVERY MOUNTED |
已经挂载了。就不用再挂载了
11.测试asm
SQL> create tablespace test datafile '+DATA' size 10m; Tablespace created. ASMCMD [+data/gs/datafile] > ls -l Type Redund Striped Time Sys Name DATAFILE UNPROT COARSE DEC 09 14:00:00 Y TEST.256.769442671 ASMCMD [+data/gs/datafile] > SQL> drop tablespace test including contents and datafiles; Tablespace dropped. |
12.更改controlfiles、归档 等参数
SQL> alter system set control_files='+DATA' scope=spfile; System altered. SQL> alter system set db_recovery_file_dest='+RECOVERY'; System altered. SQL> alter system set db_create_file_dest='+DATA'; System altered. |
13. 复制database到 +DATA
RMAN> backup as copy database format '+DATA'; |
14.启动到mount切换asm
RMAN> switch database to copy;
datafile 1 switched to datafile copy "+DATA/gs/datafile/system.260.769444077" datafile 2 switched to datafile copy "+DATA/gs/datafile/undotbs1.266.769444157" datafile 3 switched to datafile copy "+DATA/gs/datafile/sysaux.261.769444103" datafile 4 switched to datafile copy "+DATA/gs/datafile/users.267.769444165" datafile 5 switched to datafile copy "+DATA/gs/datafile/aomeidb.262.769444129" datafile 6 switched to datafile copy "+DATA/gs/datafile/tbivr.263.769444135" datafile 7 switched to datafile copy "+DATA/gs/datafile/dlbshop.264.769444143" datafile 8 switched to datafile copy "+DATA/gs/datafile/gsdlb.259.769444013" datafile 9 switched to datafile copy "+DATA/gs/datafile/mcdb.265.769444149" RMAN> recover database; Starting recover at 09-DEC-11 allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid=152 devtype=DISK starting media recovery media recovery complete, elapsed time: 00:00:05 Finished recover at 09-DEC-11 RMAN> alter database open; database opened |
15.切换temp
SQL> select name ,status from v$tempfile; NAME STATUS ----------------------------------- ------- /u01/oracle/oradata/gs/temp.dbf ONLINE SQL> alter tablespace temp add tempfile '+DATA' size 512m; Tablespace altered. SQL> alter tablespace temp drop tempfile '/u01/oracle/oradata/gs/temp.dbf'; Tablespace altered. |
16.切换redo log
SQL> select member from v$logfile; MEMBER ---------------------------------------- /u01/oracle/oradata/gs/redo03.log /u01/oracle/oradata/gs/redo02.log /u01/oracle/oradata/gs/redo01.log
SQL> alter database add logfile '+DATA' size 100m; Database altered. SQL> alter database add logfile '+DATA' size 100m; Database altered. SQL> alter database add logfile '+DATA' size 100m; Database altered.
SQL> alter system switch logfile; System altered. SQL> select group#,status from v$log;
GROUP# STATUS ---------- ---------------- 1 CURRENT 2 INACTIVE 3 INACTIVE 4 UNUSED 5 UNUSED 6 UNUSED --等group# 1、2、3变为INACTIVE就删除
SQL> alter database drop logfile '/u01/oracle/oradata/gs/redo02.log'; Database altered. SQL> alter database drop logfile '/u01/oracle/oradata/gs/redo03.log'; Database altered. SQL> alter database drop logfile '/u01/oracle/oradata/gs/redo01.log'; Database altered. |
再删除/u01/oracle/oradata下面文件就ok