Sunday, January 19, 2014

Creating ASM environment on personal computer and conversion from filesystem to ASM


C:\Users\PC001>DISKPART

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: PC001


DISKPART> CREATE VDISK FILE="D:\test\test.vhd" MAXIMUM=5000
DISKPART> CREATE VDISK FILE="D:\test\test1.vhd" MAXIMUM=5000


DISKPART> select VDISK FILE="D:\test\test.vhd"
DISKPART> attach vdisk

DISKPART> select VDISK FILE="D:\test\test1.vhd"
DISKPART> attach vdisk
==============================================================

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB  1024 KB
  Disk 1    Online         1000 MB  1920 KB        *
  Disk 2    Online         5000 MB      0 B        *
  Disk 3    Online         5000 MB      0 B        *
* Disk 4    Online        5000 MB   5000 MB

============================================================
Initialize and format disk as RAW

Right click Computer > Manage > Storage > Disk Management





























===================================================

asmtool.exe and asmtoolg.exe are oracle exe files which you can copy from Oracle Database or Grid Infrastructure installation media. You can copy these files on any location on your machine and from command prompt you can either run asmtool.exe (for command line) and asmtoolg.exe (for GUI) and stamp raw disks as ASM disks

===================================================
C:\Users\farhat>ASMTOOL -LIST
NTFS                                          \Device\Harddisk0\Partition1              100M
NTFS                                          \Device\Harddisk0\Partition2           100838M
NTFS                                          \Device\Harddisk0\Partition3           375999M
NTFS                                          \Device\Harddisk1\Partition2              966M
ORCLDISKASM2                     \Device\Harddisk2\Partition2             4966M
ORCLDISKASM3                     \Device\Harddisk3\Partition2             4966M
                                                   \Device\Harddisk4\Partition2             4966M

===================================================
C:\Users\farhat>ASMTOOL -ADD \Device\Harddisk4\Partition2 ORCLDISKASM1

===================================================
Install Grid Infrastructure Software

Install Grid Infrastructure software and create diskgroup DATA with external redundancy. Candidate disks will automatically be visible during installation.

===================================================
MIGRATE DATABASE FROM FILE SYSTEM TO ASM


SQL> alter system set db_recovery_file_dest='+DATA';

===================================================
SQL> alter system set db_create_file_dest='+DATA';

===================================================
Reset controlfile parameter so when next time we will restore controlfile it will automtically create controfiles on +DATA using db_create_file_dest patameter and +DB_RECOVERY_FILE_DEST parameter

SQL> alter system reset control_files scope=spfile;

===================================================

RMAN> shutdown immediate;
RMAN> startup nomount;

RMAN> restore controlfile from 'D:\APP\farhat\ORADATA\TEST\CONTROL01.CTL';

===================================================

Starting restore at 16-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=156 device type=DISK

channel ORA_DISK_1: copied control file copy
output file name=+DATA/test/controlfile/current.260.837010607
output file name=+DATA/test/controlfile/current.259.837010607
Finished restore at 16-JAN-14
===================================================

RMAN> backup as copy database format '+DATA';

===================================================

RMAN> switch database to copy;

===================================================

RMAN> alter database open;

===================================================

CREATE PFILE initTEST.ora under folder

D:\app\farhat\product\11.2.0.3\dbhome_1\database

Add following line in initTEST.ora

spfile='+data/test/parameterfile/spfile.258.837034947'

====================================================

SQL> select file_name from dba_temp_files;

no rows selected

SQL> alter tablespace temp add tempfile size 20m;

Tablespace altered.

SQL> select file_name from dba_temp_files;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/test/tempfile/temp.270.837035369

SQL>
====================================================
Stop current Grid Home Listener

C:\Users\PC001>srvctl stop listener

Remove Grid Home Listener

C:\Users\PC001>srvctl remove listener

Add existing Oracle Home Listener to Cluster

C:\Users\PC001>srvctl add listener -l LISTENER -o D:\app\farhat\product\11.2.0.3\dbhome_1

C:\Users\PC001>srvctl start listener

No comments:

Post a Comment