MyOracleWorld.Net  .........

 

Moving a Database From FileSystem to +ASM Storage

There is no need to run any pre-clone/post-clone steps for this exercise
Should the Oracle services not be available from this Oracle home which owns the ASM instance, you will
need to do the below from the $ORACLE_HOME/bin directory as the 'root' user:

localconfig add:

[root@lnxhpc5pw7 ~]# cd /u02/oracle/PROD/db/tech_st/10.2.0
[root@lnxhpc5pw7 10.2.0]# cd bin
[root@lnxhpc5pw7 bin]# ./localconfig add

Creating your own ASM test instance:

For testing purposes the below 4 steps can be used to create your own ASM test instance using the init+ASM.ora parameter -  _ASM_ALLOW_ONLY_RAW_DISKS=FALSE  - to simulate actual disks. You use the 'dd' command as shown below, to create flat files - to the total space required for storage - and then create an ASM instance using those flat files as physical disks

Create the Binary Files which will simulate the disks, if no disks is made available to use as ASM storage:

dd if=/dev/zero of=/u02/oracle/oradata/+ASM10G/ASM10G_file_disk01 bs=1k count=1500000
dd if=/dev/zero of=/u02/oracle/oradata/+ASM10G/ASM10G_file_disk02 bs=1k count=1500000
dd if=/dev/zero of=/u02/oracle/oradata/+ASM10G/ASM10G_file_disk03 bs=1k count=1500000
dd if=/dev/zero of=/u02/oracle/oradata/+ASM10G/ASM10G_file_disk04 bs=1k count=1500000
dd if=/dev/zero of=/u02/oracle/oradata/+ASM10G/ASM10G_file_disk05 bs=1k count=1500000
.
keep on adding more, depending on the amount of storage required. I used 89 x 1.5Gb files.
.

Create your ASM instance init+ASM.ora file in $ORACLE_HOME/dbs:

INSTANCE_TYPE = ASM
DB_UNIQUE_NAME = +ASM10G
ASM_POWER_LIMIT = 5
ASM_DISKGROUPS=ASM_EBS_1206
ASM_DISKSTRING='/u02/oracle/oradata/+ASM10G/*'
large_pool_size=12M
remote_login_passwordfile='EXCLUSIVE'
_ASM_ALLOW_ONLY_RAW_DISKS=FALSE   ==> this parameter allows for flat files to simulate physical disks

Create a password file for the +ASM instance:

 

export ORACLE_HOME=/u02/oracle/PROD/db/tech_st/10.2.0
$ORACLE_HOME/bin/orapwd file=/u02/oracle/PROD/db/tech_st/10.2.0/dbs/orapw+ASM10G force=y entries=5 password=tengee

Create the ASM instance, using all "disks" (files) discovered with the init+ASM10G.ora file:

export ORACLE_SID=+ASM10G
sqlplus "/ as sysdba"
startup nomount

create diskgroup ASM_EBS_1206 external redundancy
DISK '/u02/oracle/oradata/+ASM10G/*';




If you want to simulate HIGH redundancy using fail groups, you can use the following syntax when using i.e 90 Disks (files):
create diskgroup ASM_EBS_1206 high redundancy
failgroup controller1 DISK '/u02/oracle/oradata/+ASM10G/ASM10G_file_disk0*','/u02/oracle/oradata/+ASM10G/ASM10G_file_disk1*','/u02/oracle/oradata/+ASM10G/ASM10G_file_disk2*'
failgroup controller2 DISK '/u02/oracle/oradata/+ASM10G/ASM10G_file_disk3*','/u02/oracle/oradata/+ASM10G/ASM10G_file_disk4*','/u02/oracle/oradata/+ASM10G/ASM10G_file_disk5*'
failgroup controller3 DISK '/u02/oracle/oradata/+ASM10G/ASM10G_file_disk6*','/u02/oracle/oradata/+ASM10G/ASM10G_file_disk7*','/u02/oracle/oradata/+ASM10G/ASM10G_file_disk8*';

Get a list of all controlfiles for the database:

 

Make sure block change tracking is DISABLED - if used:

Shutdown the database:



Modify the initialization parameter file of the target database as follows:

  • Set DB_CREATE_FILE_DEST and DB_CREATE_ONLINE_LOG_DEST_n (where n=1-4) to refer to the desired ASM disk groups.
  • If the database uses a server parameter file (SPFILE), then remove the CONTROL_FILES parameter that specifies locations of the control file. The control file will be moved to the DB_CREATE_* destination and the server parameter file will be automatically updated. If you are using a client-side parameter file (PFILE), then set the CONTROL_FILES parameter to the ASM alias for the control file name (for example,CONTROL_FILES=+disk_group/cf1 ).

db_create_file_dest='+ASM_EBS_1206'
db_create_online_log_dest_1='+ASM_EBS_1206'
remove CONTROL_FILES from initPROD.ora file and replace with CONTROL_FILES=+ASM_EBS_1206/prod_cf1.dbf

Connect using RMAN to the Target database and startup NOMOUNT:

 

 

Restore the controlfile into the new location from the current location:

Mount the database now with the control file in place:

Copy the database into the ASM diskgroup using the following command:

BACKUP AS COPY DATABASE FORMAT '+ASM_EBS_1206';

and so on .......................... This will take a long time, depending on storage devices' performance



At this stage the ASM instance is the copy of the database and the file system is the 'master'.

 Switch all datafiles into the new ASM instance/group:


At this stage the ASM instance is the 'master' storage and the file system the copy.

Open the database and exit RMAN:

Check the temporary tablespace size,name,file_name and make a note of it:

Take the tempfiles into offline mode:

select tablespace_name,bytes/1024/1024,file_name,status from dba_temp_files;
offline the files returned from the above:

Unset the parameter db_create_file_dest:

Add ASM tempfiles back to the TEMP1 and TEMP2 temporary tablespaces:

Drop the offline temp files:

Do the same select again to verify the new temp ASM files:

Once you're sure all is in place and verified, delete the "copy" of the database which is now the file system storage:


Choose YES and wait:

The final result will look like this:

Now do these steps to delete the old log files and control files from within RMAN:

RMAN> HOST 'rm old_online_redo_logs';
RMAN> HOST 'rm old_control_files';

You can now start the listener and APPS and connect as usual:



$INST_TOP/admin/scripts/adstrtal.sh  apps/apps

Connect as usual

 

 

 

 
HTML Comment Box is loading comments...