Showing posts with label ASM. Show all posts
Showing posts with label ASM. Show all posts

Tuesday, May 12, 2020

Create ASM diskgroup using ASMCA



Create ASM diskgroup using ASMCA



Login as Grid user or ASM owned user and set environment 



invoke asmcma utility





It will open the GUI window that helps to create diskgroup




after click on create give diskgroup name , redundancy and many more things as per requirement in my case I am creating FRA diskgroup  with external redundancy 








FRA disk group has been created 











Tuesday, February 18, 2020

check port is open or not in linux



check port is open 
=========================


[oracle@localhost admin]$ nc -v 192.168.1.108 1521
Connection to 192.168.1.108 1521 port [tcp/ncube-lm] succeeded!
[oracle@localhost admin]$
[oracle@localhost admin]$

RMAN Duplicate from Active Database - ASM to Non-ASM filesystem

RMAN Duplicate from Active Database - ASM to Non-ASM



copy password file from source  to target 
================================================

scp orapwindia oracle@192.168.1.112:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwhrprd

Source LISTENER
===================

[oracle@localhost ~]$ cat /u01/app/grid/product/18.0.0/grid_home/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/grid/product/18.0.0/grid_home/network/admin/listener.ora
# Generated by Oracle configuration tools.

#Backup file is  /u01/app/grid/product/18.0.0/grid_home/srvm/admin/listener.ora.bak.localhost line added by Agent

VALID_NODE_CHECKING_REGISTRATION_LISTENER = ON

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.108)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u01/app/grid

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON

[oracle@localhost ~]$



Source tnsnames.ora
======================

[oracle@localhost admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

INDIA =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.108)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = india)
    )
  )


HRPRD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = hrprd)
    )
  )

[oracle@localhost admin]$




Target listener
======================

[oracle@localhost pfile]$ cat /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
    )
  )

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = hrprd)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = hrprd)
    )
  )
ADR_BASE_LISTENER = /u01/app/oracle

[oracle@localhost pfile]$


target TNsnames.ora
=======================

[oracle@localhost admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

HRPRD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.112)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = hrprd)
    )
  )




INDIA =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.108)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = india)
    )
  )



[oracle@localhost admin]$



target init file 
===================


[oracle@localhost pfile]$ cat inithrprd.ora
db_name=hrprd
[oracle@localhost pfile]$

set local listener on target 
===================================

alter system set local_listener='(ADDRESS = (PROTOCOL=TCP)(HOST=192.168.1.108)(PORT=1521))' scope=both;

create directory on target 
===============================


mkdir -p /u01/app/oracle/admin/hrprd/adump
mkdir -p /u01/app/oracle/fast_recovery_area/hrprd
mkdir -p /u01/app/oracle/oradata/hrprd
mkdir -p /u01/app/oracle/oradata/hrprd

start the target database
=================================

startup nomount pfile=/u01/app/oracle/admin/hrprd/pfile/inithrprd.ora


connect with rman on target
=============================


rman target sys/sys@india auxiliary sys/sys@hrprd




check source file location 
================================

select name from v$datafile
  union all
  select name from v$tempfile
  union all
  select name from v$controlfile
  union all
  select member from v$logfile;


Active dupliacte command
=================================

run
{
         
         DUPLICATE TARGET DATABASE TO "hrprd"
         FROM ACTIVE DATABASE
         DB_FILE_NAME_CONVERT '+DATA1/india/datafile','/u01/app/oracle/oradata/hrprd','+DATA1/india/tempfile','/u01/app/oracle/oradata/hrprd'
         SPFILE
         SET LOG_FILE_NAME_CONVERT '+DATA1/india/onlinelog','/u01/app/oracle/oradata/hrprd'
         SET AUDIT_FILE_DEST '/u01/app/oracle/admin/hrprd/adump'
         SET CONTROL_FILES '/u01/app/oracle/oradata/hrprd/control01.ctl'
         SET DB_RECOVERY_FILE_DEST '/u01/app/oracle/fast_recovery_area/hrprd'
         SET DB_CREATE_FILE_DEST '/u01/app/oracle/oradata/hrprd'
SET db_create_online_log_dest_1 '/u01/app/oracle/oradata/hrprd'
         SET DIAGNOSTIC_DEST '/u01/app/oracle/diag';
}




Duplicate log 
================

RMAN> run
{

         DUPLICATE TARGET DATABASE TO "hrprd"
         FROM ACTIVE DATABASE
         DB_FILE_NAME_CONVERT '+DATA1/india/datafile','/u01/app/oracle/oradata/hrprd','+DATA1/india/tempfile','/u01/app/oracle/oradata/hrprd'
         SPFILE
         SET LOG_FILE_NAME_CONVERT '+DATA1/india/onlinelog','/u01/app/oracle/oradata/hrprd'
         SET AUDIT_FILE_DEST '/u01/app/oracle/admin/hrprd/adump'
         SET CONTROL_FILES '/u01/app/oracle/oradata/hrprd/control01.ctl'
         SET DB_RECOVERY_FILE_DEST '/u01/app/oracle/fast_recovery_area/hrprd'
         SET DB_CREATE_FILE_DEST '/u01/app/oracle/oradata/hrprd'
                 SET db_create_online_log_dest_1 '/u01/app/oracle/oradata/hrprd'
2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14>          SET DIAGNOSTIC_DEST '/u01/app/oracle/diag';
}
15>
Starting Duplicate Db at 18-FEB-20
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '+DATA1/india/spfileindia.ora' auxiliary format
 '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilehrprd.ora'   ;
   sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilehrprd.ora''";
}
executing Memory Script

Starting backup at 18-FEB-20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=48 device type=DISK
Finished backup at 18-FEB-20

sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/dbhome_1/dbs/spfilehrprd.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''HRPRD'' comment=
 ''duplicate'' scope=spfile";
   sql clone "alter system set  LOG_FILE_NAME_CONVERT =
 ''+DATA1/india/onlinelog'', ''/u01/app/oracle/oradata/hrprd'' comment=
 '''' scope=spfile";
   sql clone "alter system set  AUDIT_FILE_DEST =
 ''/u01/app/oracle/admin/hrprd/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  CONTROL_FILES =
 ''/u01/app/oracle/oradata/hrprd/control01.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_recovery_file_dest =
 ''/u01/app/oracle/fast_recovery_area/hrprd'' comment=
 '''' scope=spfile";
   sql clone "alter system set  DB_CREATE_FILE_DEST =
 ''/u01/app/oracle/oradata/hrprd'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_create_online_log_dest_1 =
 ''/u01/app/oracle/oradata/hrprd'' comment=
 '''' scope=spfile";
   sql clone "alter system set  DIAGNOSTIC_DEST =
 ''/u01/app/oracle/diag'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''HRPRD'' comment= ''duplicate'' scope=spfile

sql statement: alter system set  LOG_FILE_NAME_CONVERT =  ''+DATA1/india/onlinelog'', ''/u01/app/oracle/oradata/hrprd'' comment= '''' scope=spfile

sql statement: alter system set  AUDIT_FILE_DEST =  ''/u01/app/oracle/admin/hrprd/adump'' comment= '''' scope=spfile

sql statement: alter system set  CONTROL_FILES =  ''/u01/app/oracle/oradata/hrprd/control01.ctl'' comment= '''' scope=spfile

sql statement: alter system set  db_recovery_file_dest =  ''/u01/app/oracle/fast_recovery_area/hrprd'' comment= '''' scope=spfile

sql statement: alter system set  DB_CREATE_FILE_DEST =  ''/u01/app/oracle/oradata/hrprd'' comment= '''' scope=spfile

sql statement: alter system set  db_create_online_log_dest_1 =  ''/u01/app/oracle/oradata/hrprd'' comment= '''' scope=spfile

sql statement: alter system set  DIAGNOSTIC_DEST =  ''/u01/app/oracle/diag'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    2371719168 bytes

Fixed Size                     2255512 bytes
Variable Size                587203944 bytes
Database Buffers            1778384896 bytes
Redo Buffers                   3874816 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''INDIA'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''HRPRD'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/u01/app/oracle/oradata/hrprd/control01.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''INDIA'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''HRPRD'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area    2371719168 bytes

Fixed Size                     2255512 bytes
Variable Size                587203944 bytes
Database Buffers            1778384896 bytes
Redo Buffers                   3874816 bytes

Starting backup at 18-FEB-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_india.f tag=TAG20200218T215741 RECID=3 STAMP=1032731861
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 18-FEB-20

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/hrprd/system.256.1030296291";
   set newname for datafile  2 to
 "/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/hrprd/users.259.1030296291";
   set newname for datafile  5 to
 "/u01/app/oracle/oradata/hrprd/example.269.1030296381";
   set newname for datafile  6 to
 "/u01/app/oracle/oradata/hrprd/test.271.1030297077";
   backup as copy reuse
   datafile  1 auxiliary format
 "/u01/app/oracle/oradata/hrprd/system.256.1030296291"   datafile
 2 auxiliary format
 "/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291"   datafile
 3 auxiliary format
 "/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291"   datafile
 4 auxiliary format
 "/u01/app/oracle/oradata/hrprd/users.259.1030296291"   datafile
 5 auxiliary format
 "/u01/app/oracle/oradata/hrprd/example.269.1030296381"   datafile
 6 auxiliary format
 "/u01/app/oracle/oradata/hrprd/test.271.1030297077"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 18-FEB-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA1/india/datafile/system.256.1030296291
output file name=/u01/app/oracle/oradata/hrprd/system.256.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA1/india/datafile/sysaux.257.1030296291
output file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA1/india/datafile/example.269.1030296381
output file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA1/india/datafile/undotbs1.258.1030296291
output file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA1/india/datafile/test.271.1030297077
output file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA1/india/datafile/users.259.1030296291
output file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291 tag=TAG20200218T215747
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 18-FEB-20

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "+DATA1/india/archivelog/2020_02_18/thread_1_seq_18.274.1032731975" auxiliary format
 "/u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_%u_.arc"   ;
   catalog clone recovery area;
   switch clone datafile all;
}
executing Memory Script

Starting backup at 18-FEB-20
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=18 RECID=3 STAMP=1032731974
output file name=/u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
Finished backup at 18-FEB-20

searching for all files in the recovery area

List of Files Unknown to the Database
=====================================
File Name: /u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc

datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/system.256.1030296291
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381
datafile 6 switched to datafile copy
input datafile copy RECID=8 STAMP=1032731977 file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077

contents of Memory Script:
{
   set until scn  1260829;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 18-FEB-20
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

starting media recovery

archived log for thread 1 with sequence 18 is already on disk as file /u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/hrprd/HRPRD/archivelog/2020_02_18/o1_mf_1_18_09uosfa7_.arc thread=1 sequence=18
media recovery complete, elapsed time: 00:00:01
Finished recover at 18-FEB-20
Oracle instance started

Total System Global Area    2371719168 bytes

Fixed Size                     2255512 bytes
Variable Size                587203944 bytes
Database Buffers            1778384896 bytes
Redo Buffers                   3874816 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''HRPRD'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''HRPRD'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area    2371719168 bytes

Fixed Size                     2255512 bytes
Variable Size                587203944 bytes
Database Buffers            1778384896 bytes
Redo Buffers                   3874816 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "HRPRD" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1 ( '/u01/app/oracle/oradata/hrprd/group_1.262.1030296357', '/u01/app/oracle/oradata/hrprd/group_1.263.1030296359' ) SIZE 50 M  REUSE,
  GROUP   2 ( '/u01/app/oracle/oradata/hrprd/group_2.264.1030296361', '/u01/app/oracle/oradata/hrprd/group_2.265.1030296363' ) SIZE 50 M  REUSE,
  GROUP   3 ( '/u01/app/oracle/oradata/hrprd/group_3.266.1030296363', '/u01/app/oracle/oradata/hrprd/group_3.267.1030296365' ) SIZE 50 M  REUSE
 DATAFILE
  '/u01/app/oracle/oradata/hrprd/system.256.1030296291'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/hrprd/temp.268.1030296373";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291",
 "/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291",
 "/u01/app/oracle/oradata/hrprd/users.259.1030296291",
 "/u01/app/oracle/oradata/hrprd/example.269.1030296381",
 "/u01/app/oracle/oradata/hrprd/test.271.1030297077";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/app/oracle/oradata/hrprd/temp.268.1030296373 in control file

cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291 RECID=1 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291 RECID=2 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291 RECID=3 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381 RECID=4 STAMP=1032731992
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077 RECID=5 STAMP=1032731992

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/sysaux.257.1030296291
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/undotbs1.258.1030296291
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/users.259.1030296291
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/example.269.1030296381
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=1032731992 file name=/u01/app/oracle/oradata/hrprd/test.271.1030297077

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 18-FEB-20

RMAN>

RMAN>

RMAN>

[oracle@localhost admin]$ !sq
sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Tue Feb 18 22:11:26 2020

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name ,open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
HRPRD     READ WRITE


Tuesday, May 15, 2018

I/O Activity Balance Across Disks in ASM


Balanced Oracle ASM Disk Groups


Check cluster name using below command:

[grid@rac1 ~]$ cemutlo -n
rac-cluster
[grid@rac1 ~]$

  • Make sure that all the disks in the same Oracle ASM disk group are the same size. Oracle ASM writes in a round-robin fashion to the Oracle ASM disk group disks; therefore, small Oracle ASM disks will be full faster than larger disks, which results in unbalanced I/O activity across the Oracle ASM disks.
  • All disks in the same Oracle ASM disk group should have the same performance characteristics




Use below query to find out ASM disks are blanced or not :-

SELECT dg.group_number "GROUP#",
       dg.name,
       DECODE (total_dg.total_io, 0, 100, 100 * (DECODE (SIGN (1 - df.sum_io / total_dg.total_io), -1, 0, (1 - df.sum_io / total_dg.total_io)))) "IO_BALANCED"
  FROM (SELECT d.group_number group_number,
                 SUM (ABS ((d.reads + d.writes) - tot.avg_io)) sum_io
            FROM v$asm_disk_stat d,
                 (SELECT group_number,
                           SUM (reads) + SUM (writes),
                           DECODE (COUNT (*), 0, 0, (SUM (reads) + SUM (writes)) / COUNT (*)) avg_io
                      FROM v$asm_disk_stat
                     WHERE header_status = 'MEMBER'
                  GROUP BY group_number) tot
           WHERE header_status = 'MEMBER' AND tot.group_number = d.group_number
        GROUP BY d.group_number) df,
       (SELECT group_number,
                 SUM (reads) + SUM (writes) total_io
            FROM v$asm_disk_stat
           WHERE header_status = 'MEMBER'
        GROUP BY group_number) total_dg,
        V$ASM_DISKGROUP dg
 WHERE df.group_number = total_dg.group_number
 AND df.group_number = dg.group_number;






In above figure shows an example of my environment where there are two disk groups in the Oracle ASM instance: DATA1 and DATA2. As you can see, the I/O activity is distributed equally across the Oracle ASM disks in each disk group. The conclusion here is that the disk groups (DATA1  and DATA2) are totally balanced.




For more explanation check below link:

https://community.oracle.com/docs/DOC-995178

Saturday, February 11, 2017

Move or Rename the Tempfile in Oracle ASM


Move or Rename the Tempfile in Oracle
==================================


Step1:-  Login as sysdba

Step2: Check Tempfile status corresponding to tablepace  using below query

 SQL> SELECT v.file#, t.file_name, v.status
   FROM dba_temp_files t, v$tempfile v
   WHERE t.file_id = v.file#
   and t.TABLESPACE_NAME='TEMP1';
    
     FILE# FILE_NAME                                STATUS
---------- ---------------------------------------- -------
         2 +DATA2/orcl/tempfile/temp1.269.935535665 ONLINE

SQL>

Step3: Make offline file which want to move using below query

SQL>
SQL> alter database tempfile '+DATA2/orcl/tempfile/temp1.269.935535665' offline;

Database altered.

SQL>
SQL>

Step 4: Check status of file

SQL> SELECT v.file#, t.file_name, v.status
   FROM dba_temp_files t, v$tempfile v
   WHERE t.file_id = v.file#
   and t.TABLESPACE_NAME='TEMP1';  2    3    4

     FILE# FILE_NAME                                STATUS
---------- ---------------------------------------- -------
         2 +DATA2/orcl/tempfile/temp1.269.935535665 OFFLINE



Step 5:- login  in asm instance and copy file to  one diskgroup to another diskgroup


[grid@rac1 ~]$ . oraenv
ORACLE_SID = [grid] ? +ASM1
The Oracle base has been set to /u01/app/grid
[grid@rac1 ~]$
[grid@rac1 ~]$ asmcmd
ASMCMD> ls
DATA1/
DATA2/
ASMCMD>
ASMCMD>
ASMCMD> cp +DATA2/orcl/tempfile/temp1.269.935535665 +DATA1/ORCL/DATAFILE/temp1_new
copying +DATA2/orcl/tempfile/temp1.269.935535665 -> +DATA1/ORCL/DATAFILE/temp1_new
ASMCMD>
ASMCMD>
ASMCMD> cd +DATA1/ORCL/DATAFILE/
ASMCMD> ls -l
Type      Redund  Striped  Time             Sys  Name
                                            N    temp1_new => +DATA1/ASM/TEMPFILE/temp1_new.256.935624893

Step 6:  Rename file to new location  using below command 

SQL> alter database rename file '+DATA2/orcl/tempfile/temp1.269.935535665' to '+DATA1/ASM/TEMPFILE/temp1_new.256.935624893';

Database altered.

SQL>

Step 7: Make online file using below command 

SQL> alter database tempfile '+DATA1/asm/tempfile/temp1_new.256.935624893' online;

Database altered.

SQL>
SQL>  SELECT v.file#, t.file_name, v.status
   FROM dba_temp_files t, v$tempfile v
   WHERE t.file_id = v.file#
   and t.TABLESPACE_NAME='TEMP1';  2    3    4

     FILE# FILE_NAME                                                    STATUS
---------- ------------------------------------------------------------ -------
         2 +DATA1/asm/tempfile/temp1_new.256.935624893                  ONLINE

SQL>



=======
Make sure file is offline otherwise get below error
----------------------------------------------------------------
SQL> Alter database rename file '+DATA2/orcl/tempfile/temp1.269.935535665' to '+DATA1/ASM/TEMPFILE/temp1_new.256.935624893';
alter database rename file '+DATA2/orcl/tempfile/temp1.269.935535665' to '+DATA1/ASM/TEMPFILE/temp1_new.256.935624893';
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01121: cannot rename database file 202 - file is in use or recovery
ORA-01110: data file 202: '+DATA2/orcl/tempfile/temp1.269.935535665'