# Fung's DBA World

## Migrate non-ASM to ASM in 12c

April 01, 2016

There are many approaches can convert file system to ASM, such as RMAn copy database image, as of 12c, you can move datafiles online, that feature enables you minimize the downtime.

### 1. Abstract

My CDB named ora12c contain one PDB named pdb1 with local file system datafiles. I have my GI standalone installed with diffenert owner GRID contains two asm disk groups, I need to migrate the whole CDB to ASM. Below is the current environment before migration.

### 2. Find out the datafiles to be converted

Connect to CDB ROOT container via RMAN, use report schema which can show you all the datafiles and tempfiles that inlcuding PDBs and CDB.

### 3. Moving the datafiles online to ASM disk group

Because there are multiple PDBs in the CDB, I need to change the session to the PDB container. I adjust the spooled file like below:

### 4. Moving the tempfile to ASM disk group

We can add the new tempfile and drop the old one to migrate the tempfile.

Query the modified result in RMAN:

### 5. Moving redo log files

Redo log files only exisit in CDB, because all PDBs share the same redo, so when crash recovery needed, only can CDB do it.

I dropped a group member and re-create it in ASM disk group to migrate the redo log files.

Query the result from the dynamic view:

### 6. Moving control files and spfile to ASM disk group

Activate the control files new location needs to bring down the database, this is the only step which need to downtime in non-ASM to ASM migration in 12c.

Shutdown the instance, bring the database in nomount mode, restore current controfiles to ASM, and modify the location of controlfiles in spfile/initial file.

Now, the spfile still in file system, I need to move it to ASM, and create a legacy initial file point to the spfile location in ASM.

Rename or remove the old initial file or spfile in \$ORACLE_HOME/dbs, edit a new initial file with below contents:

Start the database with the new spfile in ASM:

The rest tasks will be add the service to the standalone grid infrastructure, including the database, the listener.

#### 7.2 Adding the database listener resource to GI

After you installed and created GI instance, the listener will create automatically, but it cannot listen the database. The database listener cannot manage by the GI too. This step is listener migration from database to GI.

• Remove the GI listener resource
• Copy the database listener configuration to GI HOME
• Add the new listener to GI

Connect to the database via TCP/IP, if possible, reboot the OS to see if the database can autostart with the GI or not.

### 8. Trouble shooting

When I tried to start the database, encountered the below errors:

Solutions:

If you need the database autostart with the GI, don’t forget to add dba group to grid user:

EOF