Translate

Sunday 26 October 2014

How to Find ASM Block

Create Table & Insert Rows




  Find the Default Tablespace & Datafile




   


Find the ROWID





1.    

  
Find the Block Number where ROWID is stored





1.    Set the ASM Environment and run the find_block.pl






Run the dd command to generate the output





1.    

Interpret the Output











Download find_block.pl Script from below site 



References:



EDB360 Tool a Great tool by Eniktec

If you want to do performance analyis you may use this tool at free of cost. Developed by Eniktec ( Carol sierra) a Famous oracle guru who has written SQLT etc.

Note : This is just a reference link so please refer to the instructions and other things before you use it in production.

http://www.enkitec.com/products/edb360











Saturday 25 October 2014

How to Create a Shortcut for your sqlplus

Add below entry in /etc/profile


alias s='sqlplus "/as sysdba"'
[root@ora12c ~]#

You can use anything for s as alias

After this done give the command s as oracle user

[oracle@ora12c ~]$ s

SQL*Plus: Release 12.1.0.2.0 Production on Sat Oct 25 01:11:42 2014

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt                                                                                        ions

SQL>

HOW TO TRACET SRVCTL COMMANDS?

[oracle@ora12c ~]$ export SRVM_TRACE=TRUE
[oracle@ora12c ~]$ srvctl start database -d MEMRY
[main] [ 2014-10-25 01:02:13.981 EDT ] [OPSCTLDriver.setInternalDebugLevel:325]  tracing is true at level 2 to file null
[main] [ 2014-10-25 01:02:14.000 EDT ] [OPSCTLDriver.main:162]  SRVCTL arguments : args[0]=start args[1]=database args[2]=-d args[3]=MEMRY
[main] [ 2014-10-25 01:02:14.001 EDT ] [SRVMContext.init:114]  Performing SRVM Context init. Init Counter=1
[main] [ 2014-10-25 01:02:14.024 EDT ] [Library.load:194]  library.load
[main] [ 2014-10-25 01:02:14.025 EDT ] [sPlatform.isHybrid:66]  osName=Linux osArch=amd64 JVM=64 rc=false
[main] [ 2014-10-25 01:02:14.026 EDT ] [sPlatform.isHybrid:66]  osName=Linux osArch=amd64 JVM=64 rc=false
[main] [ 2014-10-25 01:02:14.026 EDT ] [Library.load:271]  Loading  library /u02/app/oracle/product/12.1.0/dbhome_1/lib/libsrvmhas12.so
[main] [ 2014-10-25 01:02:14.040 EDT ] [SRVMContext.init:131]  SRVM Context init-ed
[main] [ 2014-10-25 01:02:14.054 EDT ] [Version.isPre:610]  version to be checked 12.1.0.2.0 major version to check against 10
[main] [ 2014-10-25 01:02:14.055 EDT ] [Version.isPre:621]  isPre.java: Returning FALSE
[main] [ 2014-10-25 01:02:14.057 EDT ] [OCR.loadLibrary:328]
 Inside constructor of OCR
[main] [ 2014-10-25 01:02:14.062 EDT ] [OCR.loadLibrary:336]  Going to load the ocr library
[main] [ 2014-10-25 01:02:14.062 EDT ] [Library.load:194]  library.load
[main] [ 2014-10-25 01:02:14.063 EDT ] [sPlatform.isHybrid:66]  osName=Linux osArch=amd64 JVM=64 rc=false
[main] [ 2014-10-25 01:02:14.064 EDT ] [sPlatform.isHybrid:66]  osName=Linux osArch=amd64 JVM=64 rc=false
[main] [ 2014-10-25 01:02:14.064 EDT ] [Library.load:271]  Loading  library /u02/app/oracle/product/12.1.0/dbhome_1/lib/libsrvmocr12.so
[main] [ 2014-10-25 01:02:14.065 EDT ] [OCR.loadLibrary:338]  loaded ocr libraries
[main] [ 2014-10-25 01:02:14.067 EDT ] [SRVMContext.init:114]  Performing SRVM Context init. Init Counter=2
[main] [ 2014-10-25 01:02:14.067 EDT ] [OCR.isCluster:1000]  Calling OCRNative for isCluster()
[main] [ 2014-10-25 01:02:14.069 EDT ] [OCR.isCluster:1004]  OCR Result status = true
[main] [ 2014-10-25 01:02:14.069 EDT ] [OCR.isCluster:1016]  Bolean result = false
[main] [ 2014-10-25 01:02:14.069 EDT ] [CommandLineParser.<init>:488]  Is this a cluster? : false
[main] [ 2014-10-25 01:02:14.073 EDT ] [CommandLineParser.parse:678]  parsing cmdline args
[main] [ 2014-10-25 01:02:14.074 EDT ] [CommandLineParser.antlrParse:500]  parsing cmdline args using antlr
[main] [ 2014-10-25 01:02:14.075 EDT ] [CommandLineParser.antlrParse:558]  input args are start database -d %OPTVAL%MEMRY
[main] [ 2014-10-25 01:02:14.101 EDT ] [SrvExprParser.optverb:826]  antlr: Match verb
[main] [ 2014-10-25 01:02:14.102 EDT ] [SrvExprParser.optnoun:873]  antlr: Match noun
[main] [ 2014-10-25 01:02:14.103 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for HELP
[main] [ 2014-10-25 01:02:14.103 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.104 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for output
[main] [ 2014-10-25 01:02:14.104 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.104 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for file
[main] [ 2014-10-25 01:02:14.105 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.105 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for compatible
[main] [ 2014-10-25 01:02:14.106 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.106 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for help
[main] [ 2014-10-25 01:02:14.107 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.107 EDT ] [SrvExprParser.optval:906]  antlr: Call initOptVals for start database
[main] [ 2014-10-25 01:02:14.108 EDT ] [SrvExprParser.optval:946]  antlr: Getting OPTION VALUE
[main] [ 2014-10-25 01:02:14.108 EDT ] [SrvExprParser.optval:948]  antlr: Set -d value: %OPTVAL%MEMRY
[main] [ 2014-10-25 01:02:14.109 EDT ] [CmdOptVals.checkAndSet:734]  Calling checkAndSet for -d = -d
[main] [ 2014-10-25 01:02:14.110 EDT ] [CmdOptVals.checkAndSet:802]  Calling checkAndSet for OptEnum db = MEMRY
[main] [ 2014-10-25 01:02:14.110 EDT ] [OptVal.check:180]  Value MEMRY for option db will be set.
[main] [ 2014-10-25 01:02:14.110 EDT ] [OptVal.check:221]  db = MEMRY
[main] [ 2014-10-25 01:02:14.111 EDT ] [SrvExprParser.cmdline:529]  antlr: Set verb and noun and options
[main] [ 2014-10-25 01:02:14.111 EDT ] [SrvExprParser.srvrule:219]  antlr: Return optvals
[main] [ 2014-10-25 01:02:14.112 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for file
[main] [ 2014-10-25 01:02:14.112 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.113 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for help
[main] [ 2014-10-25 01:02:14.113 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.113 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for db
[main] [ 2014-10-25 01:02:14.114 EDT ] [OptVal.isSet:150]  m_value is MEMRY
[main] [ 2014-10-25 01:02:14.114 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for db
[main] [ 2014-10-25 01:02:14.115 EDT ] [OptVal.isSet:150]  m_value is MEMRY
[main] [ 2014-10-25 01:02:14.115 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for database
[main] [ 2014-10-25 01:02:14.115 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.116 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for db
[main] [ 2014-10-25 01:02:14.116 EDT ] [OptVal.isSet:150]  m_value is MEMRY
[main] [ 2014-10-25 01:02:14.117 EDT ] [CmdOptVals.checkRefChoices:1066]  in checkRefChoices
[main] [ 2014-10-25 01:02:14.117 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for output
[main] [ 2014-10-25 01:02:14.117 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.118 EDT ] [OPSCTLDriver.main:215]  Attempting to register interrupt handler for OPSCTL driver
[main] [ 2014-10-25 01:02:14.120 EDT ] [InterruptHandler.registerInterruptHandler:60]  Registering shutdown hook.....
[main] [ 2014-10-25 01:02:14.120 EDT ] [InterruptHandler.registerInterruptHandler:62]  Registered shutdown hook.....
[main] [ 2014-10-25 01:02:14.121 EDT ] [SRVCTLHandler.registerInterruptHandler:86]  Registered interrupt handler for OPSCTL driver
[main] [ 2014-10-25 01:02:14.121 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for compatible
[main] [ 2014-10-25 01:02:14.122 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.122 EDT ] [OPSCTLDriver.execute:345]  checking for -H option: print verbose command syntax
[main] [ 2014-10-25 01:02:14.122 EDT ] [CmdOptVals.isOptionSet:917]  Check isOptionSet for HELP
[main] [ 2014-10-25 01:02:14.123 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for help
[main] [ 2014-10-25 01:02:14.123 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.123 EDT ] [CmdOptVals.isOptionSet:917]  Check isOptionSet for HELP_H
[main] [ 2014-10-25 01:02:14.124 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for HELP
[main] [ 2014-10-25 01:02:14.124 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.141 EDT ] [CRSCache.<clinit>:74]  CRSCache: useCache is false
[main] [ 2014-10-25 01:02:14.141 EDT ] [OPSCTLDriver.execute:411]  executing 2-word command verb=3 noun=101
[main] [ 2014-10-25 01:02:14.159 EDT ] [StartAction.executeDatabase:387]  dbUniqueName=MEMRY
[main] [ 2014-10-25 01:02:14.173 EDT ] [DatabaseFactoryImpl.getInstance:320]  s_instance is null
[main] [ 2014-10-25 01:02:14.174 EDT ] [DatabaseFactoryImpl.getInstance:323]  before returning object
[main] [ 2014-10-25 01:02:14.174 EDT ] [DatabaseFactoryImpl.getDatabase:995]  Before calling get database with name and version
[main] [ 2014-10-25 01:02:14.207 EDT ] [HASContext.<init>:125]  moduleInit = 67
[main] [ 2014-10-25 01:02:14.208 EDT ] [SRVMContext.init:114]  Performing SRVM Context init. Init Counter=3
[main] [ 2014-10-25 01:02:14.208 EDT ] [HASContext.<init>:136]  Initialised SRVMContext
[main] [ 2014-10-25 01:02:14.259 EDT ] [EntityOperations.isEntityRegisteredCRSD:353]  entity: ora.memry.db, type: 1, registered: true
[main] [ 2014-10-25 01:02:14.283 EDT ] [CRSCache.getAttributesFromCache:220]  updated: ora.memry.db [<DATABASE_TYPE:SINGLE>, <ORACLE_HOME:/u02/app/oracle/product/12.1.0/dbhome_1>, <VERSION:12.1.0.2.0>]
[main] [ 2014-10-25 01:02:14.284 EDT ] [DatabaseFactoryImpl.internalGetDatabase:1115]  dbVersion4 = 12.1.0.2
[main] [ 2014-10-25 01:02:14.285 EDT ] [DatabaseFactoryImpl.internalGetDatabase:1129]  db type SINGLE
[main] [ 2014-10-25 01:02:14.287 EDT ] [Version.isPre:610]  version to be checked 12.1.0.2.0 major version to check against 11
[main] [ 2014-10-25 01:02:14.288 EDT ] [Version.isPre:621]  isPre.java: Returning FALSE
[main] [ 2014-10-25 01:02:14.289 EDT ] [Version.isPre:642]  version to be checked 12.1.0.2.0 major version to check against 11 minor version to check against 2
[main] [ 2014-10-25 01:02:14.290 EDT ] [Version.isPre:651]  isPre: Returning FALSE for major version check
[main] [ 2014-10-25 01:02:14.291 EDT ] [DatabaseFactoryImpl.getSingleInstanceDatabase:1923]  Getting single instance database for MEMRY
[main] [ 2014-10-25 01:02:14.300 EDT ] [DatabaseAction.<init>:80]  Created Database Action
[main] [ 2014-10-25 01:02:14.303 EDT ] [CRSCache.getAttributesFromCache:220]  updated: ora.memry.db [<DB_UNIQUE_NAME:MEMRY>]
[main] [ 2014-10-25 01:02:14.303 EDT ] [DatabaseImpl.crsResource:5254]  calling parent's crsResource
[main] [ 2014-10-25 01:02:14.325 EDT ] [EntityOperations.isEntityRegisteredCRSD:353]  entity: ora.memry.db, type: 1, registered: true
[main] [ 2014-10-25 01:02:14.326 EDT ] [CRSCache.getAttributesFromCache:229]  CRS cache: ora.memry.db [<DATABASE_TYPE:SINGLE>]
[main] [ 2014-10-25 01:02:14.331 EDT ] [CRSCache.getAttributesFromCache:229]  CRS cache: ora.memry.db [<DATABASE_TYPE:SINGLE>]
[main] [ 2014-10-25 01:02:14.335 EDT ] [CRSCache.getAttributesFromCRS:155]  CRS: name: ora.memry.db, type 1, node: null
[main] [ 2014-10-25 01:02:14.335 EDT ] [CRSCache.getAttributesFromCRS:156]  attrs: [HOSTING_MEMBERS]
[main] [ 2014-10-25 01:02:14.348 EDT ] [CRSCache.getAttributesFromCRS:163]  CRS: [<HOSTING_MEMBERS:>]
[main] [ 2014-10-25 01:02:14.348 EDT ] [CRSCache.getAttributesFromCRS:155]  CRS: name: ora.memry.db, type 1, node: null
[main] [ 2014-10-25 01:02:14.349 EDT ] [CRSCache.getAttributesFromCRS:156]  attrs: [SERVER_POOLS]
[main] [ 2014-10-25 01:02:14.370 EDT ] [CRSCache.getAttributesFromCRS:163]  CRS: [<SERVER_POOLS:>]
[main] [ 2014-10-25 01:02:14.388 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for eval
[main] [ 2014-10-25 01:02:14.389 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.392 EDT ] [CRSCache.getAttributesFromCache:229]  CRS cache: ora.memry.db [<DATABASE_TYPE:SINGLE>]
[main] [ 2014-10-25 01:02:14.393 EDT ] [CmdOptVals.isOptionSet:917]  Check isOptionSet for STARTOPTION_O
[main] [ 2014-10-25 01:02:14.393 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for startoption
[main] [ 2014-10-25 01:02:14.394 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.397 EDT ] [CmdOptVals.isOptionSet:861]  Calling isOptionSet for eval
[main] [ 2014-10-25 01:02:14.397 EDT ] [OptVal.isSet:150]  m_value is null
[main] [ 2014-10-25 01:02:14.398 EDT ] [StartAction.executeDatabase:547]  starting db resource with concurrency:0
[main] [ 2014-10-25 01:02:14.398 EDT ] [CRSNative.genericStartResource:293]  About to start resource: Name: ora.memry.db, force:true node: null, options: 0, filter null
[main] [ 2014-10-25 01:02:24.067 EDT ] [CRSNative.genericStartResource:327]  Start resource completed: node: null
[main] [ 2014-10-25 01:02:24.068 EDT ] [CRSNative.genericStartResource:330]  cmd output: CRS-2672: Attempting to start 'ora.memry.db' on 'ora12c'
[main] [ 2014-10-25 01:02:24.068 EDT ] [CRSNative.genericStartResource:330]  cmd output: CRS-2676: Start of 'ora.memry.db' on 'ora12c' succeeded
[main] [ 2014-10-25 01:02:24.073 EDT ] [StartAction.executeDatabase:555]  came out of start
[main] [ 2014-10-25 01:02:24.073 EDT ] [StartAction.executeDatabase:557]  Successfully started db resource
[main] [ 2014-10-25 01:02:24.073 EDT ] [InterruptHandler.unRegisterInterruptHandler:76]  UNRegistering shutdown hook.....
[main] [ 2014-10-25 01:02:24.074 EDT ] [InterruptHandler.unRegisterInterruptHandler:81]  UnRegistered shutdown hook.....
[main] [ 2014-10-25 01:02:24.074 EDT ] [OPSCTLDriver.main:233]  Unregistered OPSCTL driver's interrupt handler
[main] [ 2014-10-25 01:02:24.076 EDT ] [SRVMContext.term:151]  Performing SRVM Context Term. Term counter is 2
[oracle@ora12c ~]$