Monday, January 30, 2012


STEP BY STEP CONFIGURATION FOR ASM CREATION IN LINUX:

create ASM disk in command:
step1:
[root@dev140 oracle]# mkdir asm
[root@dev140 asm]# pwd
/oracle/asm
[root@dev140 asm]#
[root@dev140 ~]# dd if=/dev/sda2 of=/oracle/asm/disk-4 bs=1k count=5000000
output:

5000000+0 records in
5000000+0 records out

created 5gb disk
[root@dev140 ~]#

create 4 disk with same type

[root@dev140 ~]# cd /oracle/
[root@dev140 oracle]# chown -R oracle:dba asm/
[root@dev140 oracle]# chmod -R 777 asm/
[root@dev140 oracle]# cd asm/
[root@dev140 asm]# ll
total 20019600
-rwxrwxrwx  1 oracle dba 5120000000 Jan 23 16:53 disk-1
-rwxrwxrwx  1 oracle dba 5120000000 Jan 23 17:04 disk-2
-rwxrwxrwx  1 oracle dba 5120000000 Jan 23 17:06 disk-3
-rwxrwxrwx  1 oracle dba 5120000000 Jan 23 17:06 disk-4
[root@dev140 asm]#
step2:
[root@dev140 bin]$ pwd
/oracle/PROD/db/tech_st/10.2.0/bin
[root@dev140 bin]$
[root@dev140 bin]# localconfig all
output:
Usage:/oracle/PROD/db/tech_st/10.2.0/bin/localconfig [add] [delete] [ reset <destination Oracle home> ]   [-silent]   [-paramfile <Complete path of file specifying parameter values>]
[root@dev140 bin]# localconfig reset
output:
/etc/oracle does not exist. Creating it now.
/oracle/PROD/db/tech_st/10.2.0/bin/localconfig: line 549: /etc/oracle/ocr.loc: No such file or directory
/oracle/PROD/db/tech_st/10.2.0/bin/localconfig: line 571: [: too many arguments
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'root', privgrp 'root'..
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.
        dev140
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@dev140 bin]#

step3:  create ASM pwdfile & pfile
pwdfile:
[oracle@dev140 10.2.0]$ orapwd file=/oracle/PROD/db/tech_st/10.2.0/dbs/orapw+ASM password=sys

pfile: Parameter
_asm_allow_only_raw_disks=false
#asm_diskgroups='PROD_DATA1'
asm_diskstring='/oracle/asm/disk-*'
background_dump_dest=/oracle/PROD/db/tech_st/10.2.0/admin/PROD_dev140/bdump
core_dump_dest=/oracle/PROD/db/tech_st/10.2.0/admin/PROD_dev140/cdump
user_dump_dest=/oracle/PROD/db/tech_st/10.2.0/admin/PROD_dev140/udump
instance_type=asm
remote_login_passwordfile=exclusive
large_pool_size=12M
compatible=10.2.0.4.0
asm_power_limit=6
db_unique_name=+ASM

step 3: Startup steps

[oracle@dev140 dbs]$ export ORACLE_SID=+ASM
[oracle@dev140 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.4.0 - Production on Mon Jan 23 17:31:13 2012

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ORA-15110: no diskgroups mounted
SQL> create spfile from pfile;

File created.

SQL> shu immediate
ORA-15100: invalid or missing diskgroup name


ASM instance shutdown
SQL> startup nomount
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
SQL>

SQL> CREATE DISKGROUP testdb_data1 NORMAL REDUNDANCY
  2   FAILGROUP f1 DISK '/oracle/asm/disk-1','/oracle/asm/disk-2'
  3  FAILGROUP f2 DISK '/oracle/asm/disk-3','/oracle/asm/disk-4';

Diskgroup created.

SQL> shu immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted

SQL>  shu immediate
ASM diskgroups dismounted
ASM instance shutdown
SQL> startup mount
ASM instance started

Total System Global Area   83886080 bytes
Fixed Size                  1265912 bytes
Variable Size              57454344 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> select group_number, name, total_mb, free_mb, state, type from v$asm_diskgroup;

GROUP_NUMBER NAME                             TOTAL_MB    FREE_MB STATE
------------ ------------------------------ ---------- ---------- -----------
TYPE
------
           1 TESTDB_DATA1                        19528      19422 MOUNTED
NORMAL


SQL>



EX:

1.Create Diskgroup:

SQL> CREATE DISKGROUP PRODDG NORMAL REDUNDANCY
  2  FAILGROUP f1 DISK '/oracle/asm/disk-1'
  3  FAILGROUP f2 DISK '/oracle/asm/disk-2';

Diskgroup created.

SQL>

2.    ADD Disk

SQL> ALTER DISKGROUP PRODDG add
  2  FAILGROUP f1 DISK '/oracle/asm/disk-3'
  3  FAILGROUP f2 DISK '/oracle/asm/disk-4';

Diskgroup altered.

SQL>


Migration:

step:1 Backup the controlfile

RMAN> backup current controlfile format '/oracle/aa.ctl';
Starting backup at 27-JAN-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
channel ORA_DISK_1: starting piece 1 at 27-JAN-12
channel ORA_DISK_1: finished piece 1 at 27-JAN-12
piece handle=/oracle/aa.ctl tag=TAG20120127T161724 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 27-JAN-12

RMAN> shutdown immediate;

database closed
database dismounted
Oracle instance shut down

RMAN> exit


Recovery Manager complete.
[oracle@dev140 dbs]$

STEP2: Add the pfile parameter

[oracle@dev140 dbs]# vi initPROD.ora

DB_CREATE_FILE_DEST = '+PRODDG'
DB_CREATE_ONLINE_LOG_DEST_1='+PRODDG'
control_files='+PRODDG'

step2:

SQL> startup nomount pfile='/oracle/PROD/db/tech_st/10.2.0/dbs/initPROD.ora';
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size                  1271540 bytes
Variable Size             427821324 bytes
Database Buffers          633339904 bytes
Redo Buffers               11309056 bytes
SQL> create spfile from pfile;

File created.

SQL> shu immediate
ORA-01507: database not mounted


ORACLE instance shut down.

SQL>

STEP3: Restore Controfile
[oracle@dev140 dbs]$ rman target /

Recovery Manager: Release 10.2.0.4.0 - Production on Fri Jan 27 16:21:34 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount

Oracle instance started

Total System Global Area    1073741824 bytes

Fixed Size                     1271540 bytes
Variable Size                427821324 bytes
Database Buffers             633339904 bytes
Redo Buffers                  11309056 bytes

RMAN>

RMAN> restore controlfile from '/oracle/aa.ctl';

RMAN>  backup as copy database format ='+PRODDG';

RMAN> switch database to copy;

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 01/27/2012 17:24:57
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> backup archivelog all;
RMAN> recover database;

Exit

SQL> alter database open resetlogs;

Database altered.

SQL> alter database add logfile group 4;

Database altered.

SQL> alter database add logfile group 5;

Database altered.

SQL> alter database add logfile group 6;


Database altered.

SQL>

STEP4: Create New Redologs

SQL> alter database add logfile group 4;

Database altered.

SQL> alter database add logfile group 5;

Database altered.

SQL> alter database add logfile group 6;

Database altered.

STEP5: Removing Old redologs
We can drop only inactive status loggroups

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         1          1          6 1048576000          2 YES ACTIVE
   5.9651E+12 27-JAN-12

         2          1          7 1048576000          2 YES ACTIVE
   5.9651E+12 27-JAN-12

         4          1          8  104857600          1 YES ACTIVE
   5.9651E+12 27-JAN-12


    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         5          1          9  104857600          1 YES ACTIVE
   5.9651E+12 27-JAN-12

         6          1         10  104857600          1 NO  CURRENT
   5.9651E+12 27-JAN-12


SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

SQL> alter database drop logfile group 1;

Database altered.
SQL> alter database drop logfile group 2;

Database altered.

SQL>

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         4          1         12  104857600          1 YES INACTIVE
   5.9651E+12 27-JAN-12

         5          1         13  104857600          1 YES INACTIVE
   5.9651E+12 27-JAN-12

         6          1         14  104857600          1 NO  CURRENT
   5.9651E+12 27-JAN-12


SQL>

STEP 6: Create new TEMP tablespace & drop old TEMP tablespace.

SQL> create temporary tablespace TEMP_ASM tempfile size 2048m;

Tablespace created.

SQL> alter database default temporary tablespace TEMP_ASM;

Database altered.

SQL> select name from v$tablespace;

SQL>  drop tablespace TEMP1 including contents;

Tablespace dropped.

SQL> drop tablespace TEMP2 including contents;

Tablespace dropped.

SQL>




No comments:

Post a Comment