Friday, May 30, 2014

Oracle/PLSQL: ORA-12154

Oracle/PLSQL: ORA-12154

Learn the cause and how to resolve the ORA-12154 error message in Oracle.

Description

When you encounter an ORA-12154 error, the following error message will appear:
  • ORA-12154: TNS:could not resolve service name

Cause

You tried to connect to Oracle, but the service name is either missing from the TNSNAMES.ORA file or is incorrectly defined.

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Make sure that the TNSNAMES.ORA file exists and is in the correct directory.

Option #2

Make sure that the service name that you are connecting to is included in the TNSNAMES.ORA file and that it is correctly defined.

Option #3

Make sure that there are no syntax errors in the TNSNAMES.ORA file. For example, if there are unmatched brackets in the file (ie: open bracket without the corresponding close bracket), the file will be rendered unusable

ORA-12154: TNS could not resolve service name tips


ORA-12154: TNS could not resolve service name tips
 



Question:  I need help with this error: ORA-12154: TNS: could not resolve service name.
Answer:  The ORA-12154 is a very common error, always related to your local copy of the tnsnames.ora file, your listener configuration and your database name aliases.
  • Make sure that your listener is listening for the same service name that you are using. 
  • Your service name might have an alias, so check for global (world) entries and local entries.  Check:

    $ORACLE_HOME/network/admin/tnsnames.ora 
  • Check your global_name setting with this SQL:
    select * from global_name;
The query value should match your init.ora parms for db_name and db_domain,  You can change the global_name with an ALTER DATABASE command, as follows:
alter database rename global_name to xxx;
Also see these notes on configuring your tnsnames.ora file and troubleshooting network errors.
Rampant author Steve Callan notes this on the ORA-12154 error:
"One of the most common errors related to improper configuration is the "ORA-12154: TNS: could not resolve service name" error.
It is not uncommon for new users of Oracle to spend hours upon hours trying to figure out what their mistake is when ORA-12154 appears." 
The oerr utility notes this on the ORA-12154 error::
$oerr ora 12154
ORA-12154: TNS:could not resolve the connect identifier specified

Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured.
For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Action:  The following actions may be appropriate:
If you are using local naming (tnsnames.ora file):
  •  Make sure that TNSNAMES is listed as one of the values of the names.directory_path parameter in the sqlnet.ora Oracle Net profile.
  • Verify that a tnsnames.ora file exists and is in the proper directory and is accessible.
  •  Check that the net service name used as the connect identifier exists in the  tnsnames.ora file.
  •  Make sure there are no syntax errors anywhere in the  tnsnames.ora file. Look for unmatched parentheses or stray characters. Errors in a  tnsnames.ora file may make it unusable.
 If you are using directory naming:
  •  Verify that LDAP is listed as one of the values of the names.directory_path parameter in the sqlnet.ora Oracle Net profile.
  • Verify that the LDAP directory server is up and that it is accessible.
  • Verify that the net service name or database name used as the connect identifier is configured in the directory.
  • Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier
 If you are using EZCONNECT naming:
  •  Verify that EZCONNECT is listed as one of the values of the names.directory_path parameter in the sqlnet.ora Oracle Net profile.
  • Make sure the host, port and service name specified are correct.
  • Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.
NOTE: While there are many possible causes for the ORA-12154 error, it can also appear in the stack with a TNS-03505: failed to resolve name error indicating a problem occurred prior to the server being found.
Also note the similarities in numbering and content for ORA-12514, which is related to the tns listener service.

Thursday, May 29, 2014

ORA-12154: TNS:could not resolve the connect identifier specified

ORA-12154:

TNS:could not resolve the connect identifier specified
Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.
Action: - If you are using local naming (TNSNAMES.ORA file):
- Make sure that "TNSNAMES" is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)
- Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.
- Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.
- Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.
- If you are using directory naming:
- Verify that "LDAP" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
- Verify that the LDAP directory server is up and that it is accessible.
- Verify that the net service name or database name used as the connect identifier is configured in the directory.
- Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier
- If you are using easy connect naming:
- Verify that "EZCONNECT" is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
- Make sure the host, port and service name specified are correct.
- Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.

Step by Step Oracle E-Business Suite R12.2.2 to R12.2.3 upgrade

Step by Step Oracle E-Business Suite R12.2.0 to R12.2.2 upgrade


Oracle E-Business Suite Release 12.2.3 Readme (Doc ID 1586214.1)

Applying the 12.2.3 AD and TXK Release Update Pack (Doc ID 1586217.1)


Apply Consolidated Seed Table Upgrade Patch (Required)

Only for R12.2.0

 Applying the 12.2.3 AD and TXK Release Update Packs

 New Installation Customers       Path-A

 Existing R12.2 RUP Customers (EBS Release 12.2.2 or higher level)        Path-B


 Path -A 

 Source the run edition environment file.
 
 $ . <RUN_BASE>/EBSapps/appl/APPS <CONTEXT_NAME>.env

 Run adgrants.

 Download and unzip Oracle Applications DBA 12.2.3 Product Release Update Pack (R12.AD.C.Delta.3) , Patch 17023760.

 Follow the instructions in the patch readme to execute adgrants.

 Apply R12.AD.C.DELTA.3 Patch 17023760 in hotpatch mode on Run Edition Application File System:

 $ adop phase=apply patches=17023760 hotpatch=yes

 Apply R12.TXK.C.DELTA.3 Patch 17021789 in hotpatch mode on Run Edition Application File System:

 $ adop phase=apply patches=17021789 hotpatch=yes

 Instantiate the Oracle HTTP Server configuration files admin.conf, ssl.conf, mod_wl_ohs.conf on Run File System.

 $ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
 -e $CONTEXT_FILE \
 -d $FND_TOP/admin/driver/ohstmpl.drv \
 -tmpl $FND_TOP/admin/template/ssl_conf_FMW.tmp


 $ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
 -e $CONTEXT_FILE \
 -d $FND_TOP/admin/driver/ohstmpl.drv \
 -tmpl $FND_TOP/admin/template/mod_wl_ohs_conf_FMW.tmp">


 $ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
 -e $CONTEXT_FILE \
 -d $FND_TOP/admin/driver/ohstmpl.drv \
 -tmpl $FND_TOP/admin/template/admin_conf_FMW.tmp


 $ perl $FND_TOP/patch/115/bin/txkSetAppsConf.pl \
 -contextfile=$CONTEXT_FILE \
-outfile=$INST_TOP/logs/appl/rgf/TXK/test.log


Synchronize the patch file system

$ adop phase=fs_clone


PATH B - Existing 12.2 RUP level customers


Source the run edition environment file.
 
 $ . <RUN_BASE>/EBSapps/appl/APPS <CONTEXT_NAME>.env

 Run adgrants.

 Download and unzip Oracle Applications DBA 12.2.3 Product Release Update Pack (R12.AD.C.Delta.3) , Patch 17023760.

 Follow the instructions in the patch readme to execute adgrants.

 SQL> @@/u01/R12.2/other/17023760/admin/adgrants.sql APPS
 Connected.


 Apply R12.AD.C.DELTA.3 Patch 17023760  on Run Edition Application File System:

 $ adop phase=apply patches=17023760

 Apply R12.TXK.C.DELTA.3 Patch 17021789  on Run Edition Application File System:

 $ adop phase=apply patches=17021789

 Instantiate the Oracle HTTP Server configuration files admin.conf, ssl.conf, mod_wl_ohs.conf on Run File System.

 $ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
 -e $CONTEXT_FILE \
 -d $FND_TOP/admin/driver/ohstmpl.drv \
 -tmpl $FND_TOP/admin/template/ssl_conf_FMW.tmp


 $ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
 -e $CONTEXT_FILE \
 -d $FND_TOP/admin/driver/ohstmpl.drv \
 -tmpl $FND_TOP/admin/template/mod_wl_ohs_conf_FMW.tmp


 $ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
 -e $CONTEXT_FILE \
 -d $FND_TOP/admin/driver/ohstmpl.drv \
 -tmpl $FND_TOP/admin/template/admin_conf_FMW.tmp


 $ perl $FND_TOP/patch/115/bin/txkSetAppsConf.pl \
 -contextfile=$CONTEXT_FILE \
-outfile=$INST_TOP/logs/appl/rgf/TXK/test.log

Complete the online patching cycle by running the following commands in the order shown.

Source the run edition environment file:

$ . $RUN_BASE/EBSapps/appl/APPS$CONTEXT_NAME.env

$ adop phase=finalize
$ adop phase=cutover
$ adop phase=cleanup

Synchronize file systems (Conditional)

$ adop phase=fs_clone


Apply the 12.2.3 Suite-Wide Release Update Pack


Source the run edition applications environment.

$ . <RUN_BASE>/EBSapps/appl/APPS<CONTEXT_NAME>.env

Start an online patching cycle.

$ adop phase=prepare

Apply Oracle E-Business Suite Release 12.2.3 Patch 17020683 and Oracle E-Business Suite Release 12.2.3 Online Help Patch 17020685.


$ adop phase=apply patches=17020683,17020685

Instantiate the Oracle HTTP Server configuration files admin.conf, ssl.conf, and mod_wl_ohs.conf.
Source the patch edition environment file:


$ . $PATCH_BASE/EBSapps/appl/APPS$CONTEXT_NAME.env

$ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
-e $CONTEXT_FILE \
-d $FND_TOP/admin/driver/ohstmpl.drv \
-tmpl $FND_TOP/admin/template/ssl_conf_FMW.tmp


$ $ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
-e $CONTEXT_FILE \
-d $FND_TOP/admin/driver/ohstmpl.drv \
-tmpl $FND_TOP/admin/template/mod_wl_ohs_conf_FMW.tmp


$ADJVAPRG oracle.apps.ad.autoconfig.InstantiateFile \
-e $CONTEXT_FILE \
-d $FND_TOP/admin/driver/ohstmpl.drv \
-tmpl $FND_TOP/admin/template/admin_conf_FMW.tmp


$ perl $FND_TOP/patch/115/bin/txkSetAppsConf.pl \
-contextfile=$CONTEXT_FILE \
-outfile=$INST_TOP/logs/appl/rgf/TXK/test.log

Complete the online patching cycle by running the following commands in the order shown.
Source the run edition environment file:

$ . $RUN_BASE/EBSapps/appl/APPS$CONTEXT_NAME.env

$ adop phase=finalize
$ adop phase=cutover
$ adop phase=cleanup


 Post-Update Steps

 Synchronize file systems
 Synchronize the file systems using the command shown below. This action will copy the new run edition code and configuration to the other file system, to help the next online patching cycle complete faster.

$ adop phase=fs_clone

Grant flexfield value set access to specific users (conditional)

Release 12.2 includes a new security feature, flexfield value set security; it controls who can create or modify flexfield values in the Flexfield Values Setup window (FNDFFMSV). Flexfield value set security requires some mandatory setup steps before any users can create or update values in the Values window. You must perform this step if you have not already done so for a previous version of Release 12.2.

Note: See the 'Flexfield Value Set Security' chapter in Oracle® E-Business Suite Flexfields Guide, Release 12.2 (Part No. E22963-07).

Perform Product-Specific Steps (conditional)
After you have completed the steps to update all database tier nodes with the latest code level, perform the following post-update steps only if you have licensed this product:

HR Legislative customers only: refer to the step "Latest legislation data update (Hrglobal installation)" from the readme of the patch "Oracle E-Business Suite Release 12.2.3 Patch 17020683."
Oracle E-Business Suite Extensions for Oracle Endeca customers: Refer to Installing Oracle E-Business Suite Extensions for Oracle Endeca, Release 12.2 V4 Document 1574273.1 for the complete installation and configuration steps.

TNS-12541 TNS-12560 TNS-00511 Linux Error: 111

TNS-12541 TNS-12560 TNS-00511 Linux Error: 111

 [oracle@localhost ~]$ lsnrctl

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-JAN-2012 22:45:15

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
LSNRCTL> service          
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused

This problem is related with IP address. To solve, just follow the following simple steps:-

[oracle@localhost ~]$ su - root
Password:
[root@localhost ~]# vi /etc/hosts        (copy & paste the below line)


127.0.0.1       localhost.localdomain   localhost


[root@localhost ~]# su - oracle
[oracle@localhost ~]$ lsnrctl start

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 18-JAN-2012 22:51:23

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Starting /u01/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost.localdomain)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                18-JAN-2012 22:51:24
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File         /u01/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[oracle@localhost ~]$

Upgrade from 12.2.0 to 12.2.2


 

Upgrade from 12.2.0 to 12.2.2 

 Prereq:- 
Patch R12.AD.C.delta.4:R12.AD.C.delta.4








Main Patch:-
Patch12.2.3:ORACLE E-BUSINESS SUITE 12.2.3 RELEASE UPDATE PACK


 


Oracle DBA Interview Questions and Answers - RAC

Oracle DBA Interview Questions and Answers - RAC 

Oracle RAC Interview Questions and Answers

1. Where are the Clusterware files stored on a RAC environment?
The Clusterware is installed on each node (on an Oracle Home) and on the shared disks (the voting disks and the CSR file)

2. Where are the database software files stored on a RAC environment?
The base software is installed on each node of the cluster and the
database storage on the shared disks.

3. What kind of storage we can use for the shared Clusterware files?
- OCFS (Release 1 or 2)
- raw devices
- third party cluster file system such as GPFS or Veritas

4. What kind of storage we can use for the RAC database storage?
- OCFS (Release 1 or 2)
- ASM
- raw devices
- third party cluster file system such as GPFS or Veritas

5. What is a CFS?
A cluster File System (CFS) is a file system that may be accessed (read and write) by all members in a cluster at the same time. This implies that all members of a cluster have the same view.

6. What is an OCFS2?
The OCFS2 is the Oracle (version 2) Cluster File System which can be used for the Oracle Real Application Cluster.

7. Which files can be placed on an Oracle Cluster File System?
- Oracle Software installation (Windows only)
- Oracle files (controlfiles, datafiles, redologs, files described by the bfile datatype)
- Shared configuration files (spfile)
- OCR and voting disk
- Files created by Oracle during runtime
Note: There are some platform specific limitations.

8. Do you know another Cluster Vendor?
HP Tru64 Unix, Veritas, Microsoft

9. How is possible to install a RAC if we don’t have a CFS?
This is possible by using a raw device.

10. What is a raw device?
A raw device is a disk drive that does not yet have a file system set up. Raw devices are used for Real Application Clusters since they enable the sharing of disks.

11. What is a raw partition?
A raw partition is a portion of a physical disk that is accessed at the lowest possible level. A raw partition is created when an extended partition is created and logical partitions are assigned to it without any formatting. Once formatting is complete, it is called cooked partition.

12. When to use CFS over raw?
A CFS offers:
- Simpler management
- Use of Oracle Managed Files with RAC
- Single Oracle Software installation
- Autoextend enabled on Oracle datafiles
- Uniform accessibility to archive logs in case of physical node failure
- With Oracle_Home on CFS, when you apply Oracle patches CFS guarantees that the updated Oracle_Home is visible to all nodes in the cluster.
Note: This option is very dependent on the availability of a CFS on your platform.

13. When to use raw over CFS?
- Always when CFS is not available or not supported by Oracle.
- The performance is very, very important: Raw devices offer best performance without any intermediate layer between Oracle and the disk.
Note: Autoextend fails on raw devices if the space is exhausted. However the space could be added online if needed.

14. What CRS is?
Oracle RAC 10g Release 1 introduced Oracle Cluster Ready Services (CRS), a platform-independent set of system services for cluster environments. In Release 2, Oracle has renamed this product to Oracle Clusterware.

15. What is VIP IP used for?
It returns a dead connection IMMIDIATELY, when its primary node fails. Without using VIP IP, the clients have to wait around 10 minutes to receive ORA-3113: “end of file on communications channel”. However, using Transparent Application Failover (TAF) could avoid ORA-3113.

16. Why we need to have configured SSH or RSH on the RAC nodes?
SSH (Secure Shell,10g+) or RSH (Remote Shell, 9i+) allows “oracle” UNIX account connecting to another RAC node and copy/ run commands as the local “oracle” UNIX account.

17. Is the SSH, RSH needed for normal RAC operations?
No. SSH or RSH are needed only for RAC, patch set installation and clustered database creation.

18. Do we have to have Oracle RDBMS on all nodes?
Each node of a cluster that is being used for a clustered database will typically have the RDBMS and RAC software loaded on it, but not actual data files (these need to be available via shared disk).

19. What are the restrictions on the SID with a RAC database? Is it limited to 5 characters?
The SID prefix in 10g Release 1 and prior versions was restricted to five characters by install/ config tools so that an ORACLE_SID of up to max of 5+3=8 characters can be supported in a RAC environment. The SID prefix is relaxed up to 8 characters in 10g Release 2, see bug 4024251 for more information.

20. Does Real Application Clusters support heterogeneous platforms?
The Real Application Clusters do not support heterogeneous platforms in the same cluster.

21. Are there any issues for the interconnect when sharing the same switch as the public network by using VLAN to separate the network?
RAC and Clusterware deployment best practices suggests that the interconnect (private connection) be deployed on a stand-alone, physically separate, dedicated switch. On big network the connections could be instable.

22. What is the Load Balancing Advisory?
To assist in the balancing of application workload across designated resources, Oracle Database 10g Release 2 provides the Load Balancing Advisory. This Advisory monitors the current workload activity across the cluster and for each instance where a service is active; it provides a percentage value of how much of the total workload should be sent to this instance as well as service quality flag.

23. How many nodes are supported in a RAC Database?
With 10g Release 2, we support 100 nodes in a cluster using Oracle Clusterware, and 100 instances in a RAC database. Currently DBCA has a bug where it will not go beyond 63 instances. There is also a documentation bug for the max-instances parameter. With 10g Release 1 the Maximum is 63.

24. What is the Cluster Verification Utiltiy (cluvfy)?
The Cluster Verification Utility (CVU) is a validation tool that you can use to check all the important components that need to be verified at different stages of deployment in a RAC environment.

25. What versions of the database can I use the cluster verification utility (cluvfy) with?
The cluster verification utility is release with Oracle Database 10g Release 2 but can also be used with Oracle Database 10g Release 1.

26. If I am using Vendor Clusterware such as Veritas, IBM, Sun or HP, do I still need Oracle Clusterware to run Oracle RAC 10g?
Yes. When certified, you can use Vendor Clusterware however you must still install and use Oracle Clusterware for RAC. Best Practice is to leave Oracle Clusterware to manage RAC. For details see Metalink Note 332257.1 and for Veritas SFRAC see 397460.1.

27. Is RAC on VMW are supported?
Yes.

28. What is hangcheck timer used for ?
The hangcheck timer checks regularly the health of the system. If the system hangs or stop the node will be restarted automatically.

There are 2 key parameters for this module:

-> hangcheck-tick: this parameter defines the period of time between checks of system health. The default value is 60 seconds; Oracle recommends setting it to 30seconds.

-> hangcheck-margin: this defines the maximum hang delay that should be tolerated before hangcheck-timer resets the RAC node.

29. Is the hangcheck timer still needed with Oracle RAC 10g?
Yes.

30. What files can I put on Linux OCFS2?
For optimal performance, you should only put the following files on Linux OCFS2:
- Datafiles
- Control Files
- Redo Logs
- Archive Logs
- Shared Configuration File (OCR)
- Voting File
- SPFILE

31. Is it possible to use ASM for the OCR and voting disk?
No, the OCR and voting disk must be on raw or CFS (cluster file system).

32. Can I change the name of my cluster after I have created it when I am using Oracle Clusterware?
No, you must properly uninstall Oracle Clusterware and then re-install.

33. What the O2CB is?
The O2CB is the OCFS2 cluster stack. OCFS2 includes some services. These services must be started before using OCFS2 (mount/ format the file systems).

34. What the OCR file is used for?
OCR is a file that manages the cluster and RAC configuration.

35. What the Voting Disk file is used for?
The voting disk is nothing but a file that contains and manages information of all the node memberships.

36. What is the recommended method to make backups of a RAC environment?
RMAN to make backups of the database, dd to backup your voting disk and hard copies of the OCR file.

37. What command would you use to check the availability of the RAC system?
crs_stat -t -v (-t -v are optional)

38. What is the minimum number of instances you need to have in order to create a RAC?
You can create a RAC with just one server.

39. Name two specific RAC background processes
RAC processes are: LMON, LMDx, LMSn, LKCx and DIAG.

40.Can you have many database versions in the same RAC?
Yes, but Clusterware version must be greater than the greater database version.

41. What was RAC previous name before it was called RAC?
OPS: Oracle Parallel Server

42. What RAC component is used for communication between instances?
Private Interconnect.

43. What is the difference between normal views and RAC views?
A RAC view has the prefix ‘G’. For example, GV$SESSION instead of V$SESSION

44. Which command will we use to manage (stop, start) RAC services in command-line mode?
srvctl

45. How many alert logs exist in a RAC environment?
One for each instance.

46. What are Oracle Clusterware Components
Voting Disk — Oracle RAC uses the voting disk to manage cluster membership by way of a health check and arbitrates cluster ownership among the instances in case of network failures. The voting disk must reside on shared disk.

Oracle Cluster Registry (OCR) — Maintains cluster configuration information as well as configuration information about any cluster database within the cluster. The OCR must reside on shared disk that is accessible by all of the nodes in your cluster

47. How do you backup voting disk
#dd if=voting_disk_name of=backup_file_name

48. How do I identify the voting disk location
#crsctl query css votedisk

49. How do I identify the OCR file location
check /var/opt/oracle/ocr.loc or /etc/ocr.loc ( depends upon platform)
or
#ocrcheck

50. How do you backup the OCR
There is an automatic backup mechanism for OCR. The default location is : $ORA_CRS_HOME\cdata\"clustername"\
To display backups :
#ocrconfig -showbackup
To restore a backup :
#ocrconfig -restore
With Oracle RAC 10g Release 2 or later, you can also use the export command:
#ocrconfig -export -s online, and use -import option to restore the contents back.
With Oracle RAC 11g Release 1, you can do a manaual backup of the OCR with the command:
# ocrconfig -manualbackup

51. What is SCAN?
Single Client Access Name (SCAN) is s a new Oracle Real Application Clusters (RAC) 11g Release 2 feature that provides a single name for clients to access an Oracle Database running in a cluster. The benefit is clients using SCAN do not need to change if you add or remove nodes in the cluster.

52. What are Oracle Clusterware processes for 10g on Unix and Linux
Cluster Synchronization Services (ocssd) — Manages cluster node membership and runs as the oracle user; failure of this process results in cluster restart.

Cluster Ready Services (crsd) — The crs process manages cluster resources (which could be a database, an instance, a service, a Listener, a virtual IP (VIP) address, an application process, and so on) based on the resource's configuration information that is stored in the OCR. This includes start, stop, monitor and failover operations. This process runs as the root user

Event manager daemon (evmd) —A background process that publishes events that crs creates.

Process Monitor Daemon (OPROCD) —This process monitor the cluster and provide I/O fencing. OPROCD performs its check, stops running, and if the wake up is beyond the expected time, then OPROCD resets the processor and reboots the node. An OPROCD failure results in Oracle Clusterware restarting the node. OPROCD uses the hangcheck timer on Linux platforms.

RACG (racgmain, racgimon) —Extends clusterware to support Oracle- specific requirements and complex resources. Runs server callout scripts when FAN events occur.

53. What are Oracle database background processes specific to RAC
•LMS—Global Cache Service Process
•LMD—Global Enqueue Service Daemon
•LMON—Global Enqueue Service Monitor
•LCK0—Instance Enqueue Process
To ensure that each Oracle RAC database instance obtains the block that it needs to satisfy a query or transaction, Oracle RAC instances use two processes, the Global Cache Service (GCS) and the Global Enqueue Service (GES). The GCS and GES maintain records of the statuses of each data file and each cached block using a Global Resource Directory (GRD). The GRD contents are distributed across all of the active instances.

54. How do you troubleshoot node reboot
Please check metalink ...
Note 265769.1 Troubleshooting CRS Reboots
Note.559365.1 Using Diagwait as a diagnostic to get more information for diagnosing Oracle Clusterware Node evictions.

55. Is ssh required for normal Oracle RAC operation ?
"ssh" are not required for normal Oracle RAC operation. However "ssh" should be enabled for Oracle RAC and patchset installation.

56. What is the purpose of Private Interconnect ?
Clusterware uses the private interconnect for cluster synchronization (network heartbeat) and daemon communication between the the clustered nodes. This communication is based on the TCP protocol.
RAC uses the interconnect for cache fusion (UDP) and inter-process communication (TCP). Cache Fusion is the remote memory mapping of Oracle buffers, shared between the caches of participating nodes in the cluster.

57. Why do we have a Virtual IP (VIP) in Oracle RAC?
Without using VIPs or FAN, clients connected to a node that died will often wait for a TCP timeout period (which can be up to 10 min) before getting an error. As a result, you don't really have a good HA solution without using VIPs.

When a node fails, the VIP associated with it is automatically failed over to some other node and new node re-arps the world indicating a new MAC address for the IP. Subsequent packets sent to the VIP go to the new node, which will send error RST packets back to the clients. This results in the clients getting errors immediately.

58. What do you do if you see GC CR BLOCK LOST in top 5 Timed Events in AWR Report?
This is most likely due to a fault in interconnect network.
Check netstat -s
if you see "fragments dropped" or "packet reassemblies failed" , Work with your system administrator find the fault with network.

59. How many nodes are supported in a RAC Database?
10g Release 2, support 100 nodes in a cluster using Oracle Clusterware, and 100 instances in a RAC database.

60. Srvctl cannot start instance, I get the following error PRKP- 1001 CRS-0215, however sqlplus can start it on both nodes? How do you identify the problem?
Set the environmental variable SRVM_TRACE to true.. And start the instance with srvctl. Now you will get detailed error stack.

61. What is the purpose of the ONS daemon?
The Oracle Notification Service (ONS) daemon is an daemon started by the CRS clusterware as part of the nodeapps. There is one ons daemon started per clustered node.
The Oracle Notification Service daemon receive a subset of published clusterware events via the local evmd and racgimon clusterware daemons and forward those events to application subscribers and to the local listeners.

This in order to facilitate:

a. the FAN or Fast Application Notification feature or allowing applications to respond to database state changes.

b. the 10gR2 Load Balancing Advisory, the feature that permit load balancing accross different rac nodes dependent of the load on the different nodes. The rdbms MMON is creating an advisory for distribution of work every 30seconds and forward it via racgimon and ONS to listeners and applications

RECOVERY Methods in Oracle








In general there are three steps involved in restoring files:

Ensure that the target database is started in the appropriate mode for the restoration operation. For lost control files, this will be nomount mode. If the entire database needs to be restored, this will be mount mode. If datafiles that don't belong to the SYSTEM tablespace are damaged, you have the option of keeping the database open and taking only the tablespace(s)/datafile(s) that needs to be restored offline.
Start RMAN and connect to the target and recovery catalog if one is being used.
Run the appropriate RMAN RESTORE command to bring back required files. The requested files and the appropriate archived redo log files will be restored.
Once the necessary files are restored, you need to recover your database and open it for use. You can recover the database from either RMAN or SQL*Plus.

Tablespace Scripts

Tablespace Scripts

When a tablespace is getting filled up, action need to be taken (Preference-wise)

1. Resize the datafile.
2. If AUTOEXTEND ON,then resize the maxsize of the datafile.
3. Add a new datafile to the tablespace.

Note:-
Check the availability of the free space on the disk at OS level.
$df -h (Linux,AIX)
$df -gt

oracle instance process running on the server
---------------------------------------------
ps -ef | grep pmon

Set the environment for the database
------------------------------------
uname

cat /etc/oratab (Linux/AIX)
(OR)
cat /var/opt/oracle/oratab

export ORACLE_SID=<INSTANCE_NAME>
export ORACLE_HOME=/usr/app/oracle/product/10.2.0/
export PATH=$PATH:$ORACLE_HOME/bin

Database Details
----------------
sqlplus "/as sysdba"

set pages 9999 lines 300
col OPEN_MODE for a10
col HOST_NAME for a20
select name DB_NAME, INSTANCE_NAME, HOST_NAME, DATABASE_ROLE,
OPEN_MODE, version DB_VERSION, LOGINS, 
to_char(STARTUP_TIME,'DD-MON-YYYY HH24:MI:SS') "DB UP TIME"
from v$database,gv$instance;

Tablespace Utilization Script
-----------------------------
set pages 9999 lines 300

col tablespace_name format a30
col TABLESPACE_NAME heading "Tablespace|Name"
col Allocated_size heading "Allocated|Size(MB)" form 99999999.99
col Current_size heading "Current|Size(MB)" form 99999999.99
col Used_size heading "Used|Size(MB)" form 99999999.99
col Available_size heading "Available|Size(MB)" form 99999999.99
col Pct_used heading "%Used (vs)|(Allocated)" form 99999999.99

select a.tablespace_name
        ,a.alloc_size/1024/1024 Allocated_size
        ,a.cur_size/1024/1024 Current_Size
        ,(u.used+a.file_count*65536)/1024/1024 Used_size
        ,(a.alloc_size-(u.used+a.file_count*65536))/1024/1024 Available_size
        ,((u.used+a.file_count*65536)*100)/a.alloc_size Pct_used
from     dba_tablespaces t
        ,(select t1.tablespace_name
        ,nvl(sum(s.bytes),0) used
        from  dba_segments s
        ,dba_tablespaces t1
         where t1.tablespace_name=s.tablespace_name(+)
         group by t1.tablespace_name) u
        ,(select d.tablespace_name
        ,sum(greatest(d.bytes,nvl(d.maxbytes,0))) alloc_size
        ,sum(d.bytes) cur_size
        ,count(*) file_count
        from dba_data_files d
        group by d.tablespace_name) a
where t.tablespace_name=u.tablespace_name
and t.tablespace_name=a.tablespace_name
order by t.tablespace_name
/

Tablespace Utilization Script (Detailed)
-----------------------------
set pages 9999 lines 300

set heading off;
set feedback off;
col tablespace_name for a30
select 'Database Name : ' || a.name , 'Host : ' || b.host_name from v$database a,gv$instance b;
select ' '  from dual;
set heading on;
set feedback on;

break on report
compute sum of "TOTAL SIZE in MB" on report
compute sum of "ALLOCATED SIZE in MB" on report
compute sum of "USED %" on report
compute sum of "FREE %" on report
compute sum of "SPACE_NEED_ON_OS_FOR_MAXSIZE" on report

select a.tablespace_name,
round(nvl(a.total,0)) "TOTAL SIZE in MB",
round(nvl(a.asize,0)) "ALLOCATED SIZE in MB",
round(nvl(a.asize-nvl(f.free,0),0)) "USED",
round(nvl(a.total-a.asize+f.free,0)) "FREE",
nvl(f.maxfree,0) "MAX_FREE",
round(((a.total-nvl(a.total-a.asize+f.free,0))/a.total)*100) "USED %",
round((nvl(a.total-a.asize+f.free,0)/a.total)*100) "FREE %",
round(a.total - a.asize) "SPACE_NEED_ON_OS_FOR_MAXSIZE"
from (select tablespace_name, sum(bytes)/1024/1024 "ASIZE",sum(case when maxbytes > bytes
then maxbytes else bytes end)/1024/1024 total from dba_data_files group by tablespace_name) a,
(select tablespace_name, round(sum(bytes/(1024*1024))) free,round(max(bytes)/1024/1024) maxfree
from dba_free_space group by tablespace_name) f
WHERE a.tablespace_name = f.tablespace_name(+)
order by round((nvl(a.total-a.asize+f.free,0)/a.total)*100)
/

Datafiles of a particular TableSpace
-------------------------------------
set pages 9999 lines 300

col tablespace_name for a30
col file_name for a80

select tablespace_name, file_name, bytes/1024/1024 SIZE_MB, autoextensible,
maxbytes/1024/1024 MAXSIZE_MB
from dba_data_files
where tablespace_name='&tablespace_name' order by 1,2;

Database file sizes and locations
---------------------------------
set pages 9999 lines 300

set VERIFY OFF FEEDBACK OFF

COLUMN file_name         FORMAT A51        HEADING 'File Name'
COLUMN tablespace_name   FORMAT A15        HEADING 'Tablespace'
COLUMN meg               FORMAT 99,999.90  HEADING 'Megabytes'
COLUMN status            FORMAT A10        HEADING 'Status'
COLUMN autoextensible    FORMAT A3         HEADING 'Auto Extend'
COLUMN maxmeg            FORMAT 99,999     HEADING 'Max|Megabytes'
COLUMN Increment_by      FORMAT 9,999      HEADING 'Inc|By'

SPOOL ${ORACLE_SID}_datafile.lst
BREAK ON tablespace_name SKIP 1 ON REPORT
COMPUTE SUM OF meg ON tablespace_name
COMPUTE SUM OF meg ON REPORT

SELECT tablespace_name,file_name,bytes/1048576 meg,status,autoextensible,maxbytes/1048576 maxmeg,increment_by
FROM dba_data_files
UNION
SELECT tablespace_name,file_name,bytes/1048576 meg,status,autoextensible,maxbytes/1048576 maxmeg,increment_by
FROM dba_temp_files
ORDER BY tablespace_name
/
SPOOL OFF

SET VERIFY ON FEEDBACK ON

TABLESPACE DDL
--------------
set pagesize 0
set long 9999999
select dbms_metadata.get_ddl('TABLESPACE','&TABLESPACE_NAME') FROM DUAL;

To resize a datafile
--------------------
alter database datafile '&datafile_name' resize 4096M;

If AUTOEXTEND ON
------------------------
alter database datafile '&datafile_name' autoextend on maxsize 8G;

To add a new datafile in a tablespace
--------------------------------------
BEFORE ADDING A DATAFILE WE SHOULD CHECK FOR DUPLICATE DATAFILE For datafile
select tablespace_name,file_name from dba_data_files where file_name like '%&datafile_name%';

alter tablespace <TABLESPACE_NAME> add datafile '/datafile/path/datafilename.dbf' size 4G;

If AUTOEXTEND ON
----------------
alter tablespace <TABLESPACE_NAME> add datafile '/datafile/path/datafilename.dbf' size 1G autoextend on maxsize unlimited;

To Create a new tablespace
-----------------------------
create tablespace <TABLESPACE_NAME> datafile '/datafile/path/datafilename.dbf' size 4096m;

If AUTOEXTEND ON
----------------
create tablespace <TABLESPACE_NAME> datafile '/datafile/path/datafilename.dbf' size 1G autoextend on maxsize unlimited;

To Create a new tablespace with multipple datafiles
----------------------------------------------------
create tablespace <TABLESPACE_NAME> datafile '/datafile/path/datafilename_01.dbf' size 4096m;

alter tablespace <TABLESPACE_NAME> add datafile '/datafile/path/datafilename_02.dbf' size 4096m;

Schemas in a Tablespace
-----------------------
set pages 9999 lines 300

col "size MB" format 999,999,999
col "Objects" format 999,999,999

select   obj.owner "Owner"
,         obj_cnt "Objects"
,         decode(seg_size, NULL, 0, seg_size) "Size in MB"
from     (select owner, count(*) obj_cnt from dba_objects group by owner) obj
,        (select owner, ceil(sum(bytes)/1024/1024) seg_size
         from dba_segments group by owner) seg
where     obj.owner  = seg.owner(+)
order    by 3 desc ,2 desc, 1
/

All schema object details in a Tablespace
-----------------------------------------
set pages 9999 lines 300

col owner format a15
col tablespace_name format a15
col segment_name format a40
col segment_type format a20
col PARTITION_NAME format a20
col mb format 999,999,999

select  owner
,       tablespace_name
,       segment_name
,       segment_type
,       PARTITION_NAME
,       ceil(sum(bytes) / 1024 / 1024) "Size in MB"
from    dba_segments
where   tablespace_name like '&tablespace_name'
group   by segment_name
order   by ceil(sum(bytes) / 1024 / 1024) desc
/

Total space allocated by Owner
------------------------------
set pages 9999 lines 300

col    owner format a15
col    segment_name format a30
col    segment_type format a15
col     tablespace_name format a20
col    mb format 999,999,999

select  owner
,       segment_name
,       segment_type
,       tablespace_name
,       mb
from    (
        select    owner
        ,    segment_name
      ,    segment_type
        ,    tablespace_name
        ,    bytes / 1024 / 1024 "SIZE in MB"
        from    dba_segments
        order    by bytes desc
        )
/