Environment: Windows
DB version: 11.1.0.6
–Creating the ASM Instance Manually, using dbca is also ok
–create CSS service if it doesn’t exist in services
WINNT> <ORACLE_HOME>\bin\localconfig add
–create 2 1000MB os files as asmdisk
asmtool -create D:\asm\asmdisk1 1000
asmtool -create D:\asm\asmdisk2 1000
–if get an error msg, using commnd “net helpmsg errornumber” to know why
–create spfile
file: <ORACLE_HOME>\database\init+ASM.ora
INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
ASM_DISKSTRING=’D:\asm\*’
LARGE_POOL_SIZE=16M
_ASM_ALLOW_ONLY_RAW_DISKS= FALSE
–Note: The undocumented parameter _ASM_ALLOW_ONLY_RAW_DISKS is used to
– make the instance recognize virtual disks created in previous step.
–create ASM instance service
ORADIM -NEW -ASMSID +ASM -STARTMODE auto
–add diskgroup
SET ORACLE_SID=+ASM
sqlplus / as sysdba
startup nomount
create diskgroup dgroup1 external redundancy
disk ‘D:\asm\asmdisk1′,’D:\asm\asmdisk2′;
–note: using ‘D:\asm\asmdisk*’ to add all
–startup ASM, use NOMOUNT, MOUNT, RESTRICT and FORCE options
–cannot use the STARTUP OPEN syntax
SET ORACLE_SID=+ASM
sqlplus / as sysdba
SYS@+ASM>startup force
ASM instance started
Total System Global Area 535662592 bytes
Fixed Size 1334380 bytes
Variable Size 509162388 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
–add a 2000M new disk and drop the old 2 disks
–create the new one using asmtool
asmtool -create D:\oracle\oradata\asm\asmdisk1 2000
–change the asm_diskstring to find the new disk
alter system set asm_diskstring=’D:\asm\*’,'D:\oracle\oradata\asm\*’
–add the new one
ALTER DISKGROUP dgroup1 ADD DISK ‘D:\oracle\oradata\asm\asmdisk1′;
–check the status
select name,path,state,mode_status,MOUNT_STATUS from V$asm_disk;
NAME
———————————————————–
PATH
———————————————————–
————
STATE MODE_STATUS MOUNT_STATUS
———————— ——————— ————
DGROUP1_0000
D:\ASM\ASMDISK1
NORMAL ONLINE CACHED
DGROUP1_0001
D:\ASM\ASMDISK2
NORMAL ONLINE CACHED
DGROUP1_0002
D:\ORACLE\ORADATA\ASM\ASMDISK1
NORMAL ONLINE CACHED
–drop the old 2
ALTER DISKGROUP dgroup1 DROP DISK DGROUP1_0000,DGROUP1_0001;
–check the status, it is dropping
select name,path,state,mode_status,MOUNT_STATUS from V$asm_disk;
NAME
———————————————————–
PATH
———————————————————–
————
STATE MODE_STATUS MOUNT_STATUS
———————— ——————— ————
DGROUP1_0000
D:\ASM\ASMDISK1
DROPPING ONLINE CACHED
DGROUP1_0001
D:\ASM\ASMDISK2
DROPPING ONLINE CACHED
DGROUP1_0002
D:\ORACLE\ORADATA\ASM\ASMDISK1
NORMAL ONLINE CACHED
–after a while,check status with group number
SYS@+ASM>select group_number,path,state,mode_status,MOUNT_STATUS from V$asm_disk
GROUP_NUMBER
————
PATH
——————————————————————————–
————
STATE MODE_STATUS MOUNT_STATUS
———————— ——————— ———————
0
D:\ASM\ASMDISK1
NORMAL ONLINE CLOSED
0
D:\ASM\ASMDISK2
NORMAL ONLINE CLOSED
1
D:\ORACLE\ORADATA\ASM\ASMDISK1
NORMAL ONLINE CACHED
–it is ok now. let’s change the parameter asm_diskstring
alter system set asm_diskstring=’D:\oracle\oradata\asm\*’;
–views
V$ASM_DISKGROUP
V$ASM_CLIENT
V$ASM_DISK
V$ASM_FILE
V$ASM_TEMPLATE
–asm command
asmcmd
asmtool
–FTP and HTTP Access
–Using ORACLE_HOME/rdbms/admin/catxdbdbca to create file mapping
–the first parameter is ftp port, the second one is http port
sqlplus>@catxdbdbca 7777 8888
ftp localhost 7777
http://localhost:8888
–create ASM based database bye setting 2 initial parameters
DB_CREATE_FILE_DEST = ‘+dgroup1′
DB_RECOVERY_FILE_DEST = ‘+dgroup2′
Filed under: Data Management | Tagged: 11g, asm, scratch
reference:http://www.globusz.com/ebooks/Oracle/00000020.htm
Migrating Your Database to ASM
1. Obtain current control file and redo log files locations using V$CONTROLFILE and V$LOGFILE
2. Shut down cleanly the database
3. Set the parameters to make the database OMF-based.
DB_CREATE_FILE_DEST = ‘+dgroup1′
DB_RECOVERY_FILE_DEST = ‘+dgroup2′
4. Delete the control file parameter from your SPFILE.
5. Startup the database in NOMOUNT
6. Using RMAN issue the following script:
RESTORE CONTROLFILE FROM ‘/u1/c1.ctl’;
ALTER DATABASE MOUNT;
BACKUP AS COPY DATABASE FORMAT ‘+dgroup1′;
SWITCH DATABASE TO COPY;
SQL “ALTER DATABASE RENAME ‘/u1/log1′ TO ‘+dgroup1′ “;
# Repeat RENAME command for all online redo log members …
ALTER DATABASE OPEN RESETLOGS;
SQL “alter tablespace temp add tempfile”
SQL “ALTER DATABASE TEMPFILE ‘/u1/temp1′ DROP”;
–
–migrate ASM database to file system
–
SYS@ONASM>alter database backup controlfile to ‘D:\oracle\oradata\ora11g\ctl.bak’;
Database altered.
–change init parameter
#*.control_files=’+DGROUP1/onasm/controlfile/current.256.670019259′
#*.db_create_file_dest=’+DGROUP1′
*.db_create_file_dest=’D:\oracle\oradata\ora11g\’
SYS@ONASM>startup nomount
RMAN> RESTORE CONTROLFILE FROM ‘D:\ctl.bak’;
RMAN> alter database mount;
RMAN> BACKUP AS COPY DATABASE FORMAT ‘D:\oracle\oradata\ora11g\ONASM\%U’;
RMAN> SWITCH DATABASE TO COPY;
SQL>ALTER DATABASE RENAME FILE ‘+DGROUP1/onasm/onlinelog/group_1.257.670019261′ TO ‘D:\oracle\oradata\ora11g\ONASM\redo01.log’;
SQL>ALTER DATABASE RENAME FILE ‘+DGROUP1/onasm/onlinelog/group_2.258.670019265′ TO ‘D:\oracle\oradata\ora11g\ONASM\redo02.log’;
SQL>ALTER DATABASE RENAME FILE ‘+DGROUP1/onasm/onlinelog/group_3.259.670019269′ TO ‘D:\oracle\oradata\ora11g\ONASM\redo03.log’;
SQL>ALTER DATABASE OPEN RESETLOGS;
–
–rename the previous database from ONASM to ORA11G
–
SYS@ONASM>alter database backup controlfile to trace;
SYS@ONASM>shutdown immediate
–find the trace file and open it to get creating new controlfile statement
WINNT>oradim -new -sid ora11g -syspwd oracle -startmode manual
–copy the datafiles and redo logs to the new location
– from D:\oracle\oradata\ora11g\ONASM to D:\ORACLE\ORADATA\ORA11G with new names
move D:\ORACLE\ORADATA\ORA11G\ONASM\DATA_D-ONASM_I-2333620726_TS-SYSTEM_FNO-1_04K1RA4M to D:\ORACLE\ORADATA\ORA11G\SYSTEM.DBF
…
–use SET instead of REUSE when changing db name, using RESETLOGS
STARTUP NOMOUNT
CREATE CONTROLFILE SET DATABASE “ORA11G” RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ‘D:\ORACLE\ORADATA\ORA11G\REDO01.LOG’ SIZE 50M,
GROUP 2 ‘D:\ORACLE\ORADATA\ORA11G\REDO02.LOG’ SIZE 50M,
GROUP 3 ‘D:\ORACLE\ORADATA\ORA11G\REDO03.LOG’ SIZE 50M
– STANDBY LOGFILE
DATAFILE
‘D:\ORACLE\ORADATA\ORA11G\SYSTEM.DBF’,
‘D:\ORACLE\ORADATA\ORA11G\SYSAUX.DBF’,
‘D:\ORACLE\ORADATA\ORA11G\UNDOTBS1.DBF’,
‘D:\ORACLE\ORADATA\ORA11G\USERS.DBF’,
‘D:\ORACLE\ORADATA\ORA11G\DATA.DBF’
CHARACTER SET AL32UTF8
;
SYS@ORA11G>alter database open resetlogs;
SYS@ORA11G>alter tablespace temp add tempfile ‘D:\oracle\oradata\ora11g\TEMP.DBF’ size 100M;