Quantcast
Channel: Sameer Shaik. B.E,M.S,M.B.A,P.M.P,C.S.M
Viewing all 191 articles
Browse latest View live

Configure the database instance to support shared server connections

$
0
0
Shared Server Architecture
In a shared server architecture, a dispatcher directs multiple incoming network session requests to a pool of shared server processes, eliminating the need for a dedicated server process for each connection. An idle shared server process from the pool picks up a request from a common queue.


Advantages:
  • Reduces the number of processes on the operating system
  • A small number of shared servers can perform the same amount of processing as many dedicated servers.
  • Reduces instance PGA memory
  • Every dedicated or shared server has a PGA. Fewer server processes means fewer PGAs and less process management.
  • Increases application scalability and the number of clients that can simultaneously connect to the database
  • May be faster than dedicated server when the rate of client connections and disconnections is high


Disadvantages:
Slower response time in some cases
incomplete feature support, and
increased complexity for setup and tuning.

As a general guideline, only use shared server when you have more concurrent connections to the database than the operating system can handle.


 
 
 
 
 
 
 
 
 
 
 
Dispatcher Processes (Dnnn)
The dispatcher processes enable client processes to share a limited number of server processes. You can create multiple dispatcher processes for a single database instance.

Dispatcher processes establish communication as follows:
  1. When an instance starts, the network listener process opens and establishes a communication pathway through which users connect to Oracle Database.
  2. Each dispatcher process gives the listener process an address at which the dispatcher listens for connection requests.
  3. At least one dispatcher process must be configured and started for each network protocol that the database clients will use.
  4. When a client process makes a connection request, the listener determines whether the client process should use a shared server process:
  • If the listener determines that a shared server process is required, then the listener returns the address of the dispatcher process that has the lightest load, and the client process connects to the dispatcher directly.
  • If the process cannot communicate with the dispatcher, or if the client process requests a dedicated server, then the listener creates a dedicated server and establishes an appropriate connection.


Restricted Operations of the Shared Server

Certain administrative activities cannot be performed while connected to a dispatcher process, including shutting down or starting an instance and media recovery. These activities are typically performed when connected with administrator privileges. To connect with administrator privileges in a system configured with shared servers, you must specify that you want to use a dedicated server process.

Enable Shared Server:
If SHARED_SERVERS is not included in the initialization parameter file at database startup, but DISPATCHERS is included and it specifies at least one dispatcher, shared server is enabled. In this case, the default for SHARED_SERVERS is 1.

If neither SHARED_SERVERS nor DISPATCHERS is included in the initialization file, you cannot start shared server after the instance is brought up by just altering the DISPATCHERS parameter. You must specifically alter SHARED_SERVERS to a nonzero value to start shared server.

Determining a Value for SHARED_SERVERS

The SHARED_SERVERS initialization parameter specifies the minimum number of shared servers that you want created when the instance is started. After instance startup, Oracle Database can dynamically adjust the number of shared servers based on how busy existing shared servers are and the length of the request queue.

Configuring Dispatchers

The DISPATCHERS initialization parameter configures dispatcher processes in the shared server architecture. At least one dispatcher process is required for shared server to work.If you do not specify a dispatcher, but you enable shared server by setting SHARED_SERVER to a nonzero value, then by default Oracle Database creates one dispatcher for the TCP protocol.

DISPATCHERS Initialization Parameter Attributes



ADDRESS
Specify the network protocol address of the endpoint on which the dispatchers listen.
DESCRIPTION
Specify the network description of the endpoint on which the dispatchers listen, including the network protocol address. The syntax is as follows: (DESCRIPTION=(ADDRESS=...))
PROTOCOL
Specify the network protocol for which the dispatcher generates a listening endpoint. For example: (PROTOCOL=tcp)
DISPATCHERS
Specify the initial number of dispatchers to start.
CONNECTIONS
Specify the maximum number of network connections to allow for each dispatcher.
SESSIONS
Specify the maximum number of network sessions to allow for each dispatcher.
TICKS
Specify the duration of a TICK in seconds. A TICK is a unit of time in terms of which the connection pool timeout can be specified. Used for connection pooling.
LISTENER
Specify an alias name for the listeners with which the PMON process registers dispatcher information. Set the alias to a name that is resolved through a naming method.
MULTIPLEX
Used to enable the Oracle Connection Manager session multiplexing feature.
POOL
Used to enable connection pooling.
SERVICE
Specify the service names the dispatchers register with the listeners.

Determining the Number of Dispatchers

Once you know the number of possible connections for each process for the operating system, calculate the initial number of dispatchers to create during instance startup, for each network protocol, using the following formula:

Number of dispatchers =
  CEIL ( max. concurrent sessions / connections for each dispatcher )
Monitor the following views to determine the load on the dispatcher processes:
  • V$QUEUE
  • V$DISPATCHER
  • V$DISPATCHER_RATE


Disabling Shared Server

You disable shared server by setting SHARED_SERVERS to 0.
If both SHARED_SERVERS and MAX_SHARED_SERVERS are set to 0, then all shared servers will terminate and requests from remaining shared server clients will be queued until the value of SHARED_SERVERS or MAX_SHARED_SERVERS is raised again

To terminate dispatchers once all shared server clients disconnect, enter this statement:
ALTER SYSTEM SET DISPATCHERS = '';

Shared Server Data Dictionary Views



V$DISPATCHER
Provides information on the dispatcher processes, including name, network address, status, various usage statistics, and index number.
V$DISPATCHER_CONFIG
Provides configuration information about the dispatchers.
V$DISPATCHER_RATE
Provides rate statistics for the dispatcher processes.
V$QUEUE
Contains information on the shared server message queues.
V$SHARED_SERVER
Contains information on the shared servers.
V$CIRCUIT
Contains information about virtual circuits, which are user connections to the database through dispatchers and servers.
V$SHARED_SERVER_MONITOR
Contains information for tuning shared server.
V$SGA
Contains size information about various system global area (SGA) groups. May be useful when tuning shared server.
V$SGASTAT
Contains detailed statistical information about the SGA, useful for tuning.
V$SHARED_POOL_RESERVED
Lists statistics to help tune the reserved pool and space within the shared pool.



Demo:

SHAIKDB>select name from v$database;

NAME
---------
SHAIKDB

SHAIKDB>show parameter shared_server

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
max_shared_servers            integer
shared_server_sessions            integer
shared_servers                integer     1

SHAIKDB>show parameter dispatchers

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
dispatchers                string     (PROTOCOL=TCP) (SERVICE=SHAIKD
                       BXDB)
max_dispatchers             integer


SHAIKDB>

SHAIKDB>show parameter circuit

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
circuits                        integer

[oracle@collabn1 sf_stage]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 14-SEP-2015 00:14:03

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

Welcome to LSNRCTL, type "help" for information.


LSNRCTL> set current_listener SHAIKDB
Current Listener is SHAIKDB

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 1 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:2 refused:0
        LOCAL SERVER
The command completed successfully

SHAIKDB>set linesize 32000
SHAIKDB>set lines 100
SHAIKDB>col network for a50

SHAIKDB>select name,network,idle,busy,listener from v$dispatcher;

NAME NETWORK                             IDLE     BUSY    LISTENER
---- --------------------------------------------------            ---------- ---------- ----------
D000 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)     720608        0           0
    (PORT=31446))


SHAIKDB>select name,status,busy,circuit from v$shared_server;

NAME STATUS           BUSY CIRCUIT
---- ---------------- ---------- ----------------
S000 WAIT(COMMON)           0 00
SHAIKDB>alter system set dispatchers="(PROTOCOL=tcp)(DISPATCHERS=3)";

System altered.

SHAIKDB>show parameter dispatchers

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
dispatchers                string     (PROTOCOL=tcp)(DISPATCHERS=3)
max_dispatchers             integer


LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaikmeer" has 1 instance(s).
 Instance "SHAIKDB", status READY, has 4 handler(s) for this service...
    Handler(s):
     "D002" established:0 refused:0 current:0 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 19515>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=62261))
     "D001" established:0 refused:0 current:0 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 19513>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=38108))
     "D000" established:0 refused:0 current:0 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 29661>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=31446))
     "DEDICATED" established:0 refused:0 state:ready
        LOCAL SERVER
Service "SHAIKDB.shaiksameer" has 1 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
The command completed successfully




[oracle@collabn1 admin]$ vi tnsnames.ora

shared =
 (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1522))
    (CONNECT_DATA =
     (SERVER = shared)
     (SERVICE_NAME = SHAIKDB.shaiksameer)
    )
 )


[oracle@collabn1 admin]$ sqlplus test@shared

SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 14 00:34:42 2015

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

Enter password:

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





LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 2 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
 Instance "SHAIKDB", status READY, has 4 handler(s) for this service...
    Handler(s):
     "D002" established:0 refused:0 current:0 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 23609>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=41339))
     "D001" established:0 refused:0 current:0 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 23607>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=38905))
     "D000" established:1 refused:0 current:1 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 23605>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=26328))
     "DEDICATED" established:0 refused:0 state:ready
        LOCAL SERVER
The command completed successfully


SHAIKDB>SET LINESIZE 32000
SHAIKDB>set lines 100
SHAIKDB>col network for a50

SHAIKDB>select name,network,idle,busy,listener from v$dispatcher;

NAME NETWORK                             IDLE     BUSY    LISTENER
---- -------------------------------------------------- ---------- ---------- ----------
D000 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)      20004        1           0
    (PORT=26328))

D001 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)      20004        0           0
    (PORT=38905))

D002 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)      20003        0           0
    (PORT=41339))


SHAIKDB>select name,status,busy,circuit from v$shared_server;

NAME STATUS           BUSY CIRCUIT
---- ---------------- ---------- ----------------
S000 WAIT(COMMON)           4 00



NAME NETWORK                             IDLE     BUSY    LISTENER
---- -------------------------------------------------- ---------- ---------- ----------
D000 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)      75378        1           0
    (PORT=26328))

D001 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)      75378        0           0
    (PORT=38905))

D002 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)      75377        0           0
    (PORT=41339))


SHAIKDB>select name,status,busy,circuit from v$shared_server;

NAME STATUS           BUSY CIRCUIT
---- ---------------- ---------- ----------------
S000 WAIT(COMMON)          11 00



SHAIKDB>col username for a10
SHAIKDB>col osuser for a10
SHAIKDB>col for machine for a15
SHAIKDB>col service_name for a20
SHAIKDB>set linesize 32000

SHAIKDB>select username,sid,serial#,osuser,machine,status,service_name,state from v$session  where username='TEST';


USERNAME      SID     SERIAL# OSUSER     MACHINE        STATUS   SERVICE_NAME      STATE
---------- ---------- ---------- ---------- --------------- -------- -------------------- -------------------
TEST           1           8 oracle     collabn1.shaiks INACTIVE SHAIKDB.SHAIKSAMEER  WAITING
                      ameer

Create 10 users and start making connections to the DB:

#!/bin/bash
ORACLE_SID=SHAIKDB
ORACLE_BASE=/u01/app/oracle
ORAENV_ASK=NO
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
export ORACLE_HOME ORACLE_SID ORACLE_BASE
for i in {1..10};
do
source /home/oracle/shaikdb.ora
#$ORACLE_HOME/bin/sqlplus -s test/test@shared<<EOF
$ORACLE_HOME/bin/sqlplus -s / as sysdba<<EOF
create user test$i identified by test$i;
grant create session to test$i;
EOF
done


#!/bin/bash
ORACLE_SID=SHAIKDB
ORACLE_BASE=/u01/app/oracle
ORAENV_ASK=NO
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
export ORACLE_HOME ORACLE_SID ORACLE_BASE
for i in {1..10};
do
source /home/oracle/shaikdb.ora
$ORACLE_HOME/bin/sqlplus -s test$i/test$i@shared<<EOF
select sysdate from dual;
EOF
done

SHAIKDB>select name,status,busy,circuit from v$shared_server;

NAME STATUS           BUSY CIRCUIT
---- ---------------- ---------- ----------------
S000 WAIT(COMMON)          84 00

SHAIKDB>select name,network,idle,busy,listener from v$dispatcher;

NAME NETWORK                             IDLE     BUSY    LISTENER
---- -------------------------------------------------- ---------- ---------- ----------
D000 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)     190305        5           0
    (PORT=26328))

D001 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)     190308        1           0
    (PORT=38905))

D002 (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)     190308        0           0
    (PORT=41339))


SHAIKDB>col network for a40
SHAIKDB>col listener for a50

SHAIKDB> select network,listener from v$dispatcher_config;

NETWORK                 LISTENER
---------------------------------------- --------------------------------------------------
(ADDRESS=(PARTIAL=YES)(PROTOCOL=tcp))     (ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)
                   (port=1522)), (address=(protocol=tcp)(host=collabn
                   1.shaiksameer)(port=1523))



Reduce the # of dispatchers:

SHAIKDB>alter system set dispatchers="(PROTOCOL=TCP)(DISPATCHERS=1)";

System altered.

SHAIKDB>select name,status from v$dispatcher;

NAME STATUS
---- ----------------
D000 WAIT
D001 TERMINATE
D002 TERMINATE



SHAIKDB>/

NAME STATUS
---- ----------------
D000 WAIT


Kill a dispatcher:


SHAIKDB>alter system set dispatchers="(PROTOCOL=TCP)(DISPATCHERS=2)";

System altered.

SHAIKDB>select name,status from v$dispatcher;

NAME STATUS
---- ----------------
D000 WAIT
D001 WAIT


SHAIKDB>alter system shutdown immediate 'D001';

System altered.

SHAIKDB>select name,status from v$dispatcher;

NAME STATUS
---- ----------------
D000 WAIT
D001 TERMINATE


SHAIKDB>/

NAME STATUS
---- ----------------
D000 WAIT


LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 2 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
 Instance "SHAIKDB", status READY, has 2 handler(s) for this service...
    Handler(s):
     "D000" established:40 refused:0 current:1 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 23605>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=26328))
     "DEDICATED" established:0 refused:0 state:ready
        LOCAL SERVER
The command completed successfully



start some more user sessions:

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 2 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
 Instance "SHAIKDB", status READY, has 2 handler(s) for this service...
    Handler(s):
     "D000" established:60 refused:0 current:21 max:1022 state:ready
        DISPATCHER <machine: collabn1.shaiksameer, pid: 23605>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=26328))
     "DEDICATED" established:0 refused:0 state:ready
        LOCAL SERVER
The command completed successfully


SHAIKDB>select name,status,busy,circuit from v$shared_server;

NAME STATUS           BUSY CIRCUIT
---- ---------------- ---------- ----------------
S000 WAIT(COMMON)         100 00

SHAIKDB>select name,status from v$dispatcher;

NAME STATUS
---- ----------------
D000 WAIT

SHAIKDB>alter system shutdown immediate 'D000';

System altered.

SHAIKDB>select name,status from v$dispatcher;

NAME STATUS
---- ----------------
D000 TERMINATE



LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 2 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
 Instance "SHAIKDB", status READY, has 2 handler(s) for this service...
    Handler(s):
     "D000" established:60 refused:0 current:0 max:1022 state:blocked
        DISPATCHER <machine: collabn1.shaiksameer, pid: 23605>
        (ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=26328))
     "DEDICATED" established:0 refused:0 state:ready
        LOCAL SERVER
The command completed successfully


Now when I tried to make a connection using shared server:

[oracle@collabn1 sshaik]$ ./conn.sh
1
ERROR:
ORA-12520: TNS:listener could not find available handler for requested type of
server


No shared servers or dispatchers available:

SHAIKDB>select name,status from v$dispatcher;

no rows selected

SHAIKDB>select name,status,busy,circuit from v$shared_server;

no rows selected

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 2 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
 Instance "SHAIKDB", status READY, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0 state:ready
        LOCAL SERVER
The command completed successfully


Oracle oerr utility

$
0
0
It is nice to look up the ORA error on the server itself before surfing for clues on the web:

Setup the ENV:

[oracle@collabn1 ~]$ env | grep ORA
ORACLE_SID=SHAIKDB
ORACLE_BASE=/u01/app/oracle
ORAENV_ASK=NO
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD

EX:
oerr codeerror_number
 
 
[oracle@collabn1 trace]$ oerr ora 01555

01555, 00000, "snapshot too old: rollback segment number %s with name \"%s\" too small"
// *Cause: rollback records needed by a reader for consistent read are
//       overwritten by other writers
// *Action: If in Automatic Undo Management mode, increase undo_retention
//          setting. Otherwise, use larger rollback segments

Oracle Network Tracing

$
0
0
ocm11g : Setup netowrk Tracing
 
How to set up network tracing for Oracle Listener/SQLNET

  1. Setup listener Trace
  2. Setup sqlnet.ora trace
  3. Different Trace Levels


ADR Dir for listener:

[oracle@collabn1 trace]$ pwd
/u01/app/oracle/diag/tnslsnr/collabn1/shaikdb/trace



Subdirectory Name
Contents
alert
The XML-formatted log named log.xml
cdump
Core files
incident
Multiple subdirectories, where each subdirectory is named for a particular incident, and where each contains dumps pertaining only to that incident
trace
Background and server process trace files, SQL trace files, and text version of the log.xml file in the alert directory
(others)
Other subdirectories of ADR home, which store incident packages, health monitor reports, and other information


[oracle@collabn1 trace]$ vi shaikdb.log

Sun Sep 13 12:19:29 2015
Create Relation ADR_CONTROL
Create Relation ADR_INVALIDATION
Create Relation INC_METER_IMPT_DEF
Create Relation INC_METER_PK_IMPTS
System parameter file is /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/collabn1/shaikdb/alert/log.xml
Trace information written to /u01/app/oracle/diag/tnslsnr/collabn1/shaikdb/trace/ora_13146_139713732392704.trc
Trace level is currently 0

Started with pid=13146
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1522)))
Listener completed notification to CRS on start



sqlnet.ora File Diagnostic Parameter Comparison


Parameter
DIAG_ADR_ENABLED=OFF
DIAG_ADR_ENABLED=ON
ADR_BASE
Disabled
Enabled
TRACE_LEVEL_CLIENT
Enabled
Enabled
TRACE_LEVEL_SERVER
Enabled
Enabled
TRACE_DIRECTORY_CLIENT
Enabled
Disabled
TRACE_FILE_CLIENT
Enabled
Disabled
TRACE_UNIQUE_CLIENT
Enabled
Disabled
LOG_DIRECTORY_CLIENT
Enabled
Disabled
LOG_FILE_CLIENT
Enabled
Disabled
LOG_DIRECTORY_SERVER
Enabled
Disabled
TRACE_DIRECTORY_SERVER
Enabled
Disabled
TRACE_FILE_SERVER
Enabled
Disabled



listener.ora File Diagnostic Parameter Comparison


Parameter
DIAG_ADR_ENABLED=OFF
DIAG_ADR_ENABLED=ON
ADR_BASE_listener_name
Disabled
Enabled
LOGGING_listener_name
Enabled
Enabled
TRACE_LEVEL_listener_name
Enabled
Enabled
TRACE_TIMESTAMP_listener_name
Enabled
Enabled
LOG_DIRECTORY_CLIENT_listener_name
Enabled
Disabled
LOG_FILE_CLIENT_listener_name
Enabled
Disabled
TRACE_DIRECTORY_CLIENT_listener_name
Enabled
Disabled
TRACE_FILELEN_listener_name
Enabled
Disabled
TRACE_FILENO_listener_name
Enabled
Disabled



cman.ora File Diagnostic Parameter Comparison


Parameter
DIAG_ADR_ENABLED=OFF
DIAG_ADR_ENABLED=ON
ADR_BASE
Disabled
Enabled
LOG_LEVEL
Enabled
Enabled
TRACE_LEVEL
Enabled
Enabled
TRACE_TIMESTAMP
Enabled
Enabled
LOG_DIRECTORY
Enabled
Disabled
TRACE_DIRECTORY
Enabled
Disabled
TRACE_FILELEN
Enabled
Disabled
TRACE_FILENO
Enabled
Disabled



To view trace files using ADRCI, enter ADRCI at a command line.

Client Side
adrci>> SHOW ALERT
adrci>> SHOW BASE -product client
adrci>> SET BASE -product client
adrci>> SHOW TRACEFILE
adrci>> SHOW TRACE trace_file.trc
adrci>> SHOW SPOOL
In the preceding commands, SHOW ALERT will show the log.xml file in a text editor, such as VI. SHOW BASE -product client displays the value of ADR_BASE for the client. Use that value for client in the SET BASE command.
The following are common ADRCI commands to check a server:
Server Side
adrci>> SHOW BASE
adrci>> SHOW TRACEFILE
adrci>> SHOW TRACE trace_file.trc


Demo:

[oracle@collabn1 trace]$ adrci

ADRCI: Release 11.2.0.1.0 - Production on Mon Sep 14 09:40:27 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u01/app/oracle"
adrci> show alert

ADR Home = /u01/app/oracle/diag/tnslsnr/collabn1/shaikdb:
*************************************************************************
Output the results to file: /tmp/alert_24020_1406_shaikdb_1.ado



adrci> help

HELP [topic]
  Available Topics:
       CREATE REPORT
       ECHO
       EXIT
       HELP
       HOST
       IPS
       PURGE
       RUN
       SET BASE
       SET BROWSER
       SET CONTROL
       SET ECHO
       SET EDITOR
       SET HOMES | HOME | HOMEPATH
       SET TERMOUT
       SHOW ALERT
       SHOW BASE
       SHOW CONTROL
       SHOW HM_RUN
       SHOW HOMES | HOME | HOMEPATH
       SHOW INCDIR
       SHOW INCIDENT
       SHOW PROBLEM
       SHOW REPORT
       SHOW TRACEFILE
       SPOOL

There are other commands intended to be used directly by Oracle, type
"HELP EXTENDED" to see the list


adrci> show problem

ADR Home = /u01/app/oracle/diag/tnslsnr/collabn1/shaikdb:
*************************************************************************
0 rows fetched


On Linux and UNIX platforms you can use the ADAPTERS utility to verify protocol support. On the database server, run the following command from the ORACLE_HOME/bin director


[oracle@collabn1 trace]$ adapters

Installed Oracle Net transport protocols are:

    IPC
    BEQ
    TCP/IP
    SSL
    RAW
    SDP/IB

Installed Oracle Net naming methods are:

    Local Naming (tnsnames.ora)
    Oracle Directory Naming
    Oracle Host Naming
  Error!!!   Oracle Names Server Naming is not completely installed!

Installed Oracle Advanced Security options are:

    RC4 40-bit encryption
    RC4 56-bit encryption
    RC4 128-bit encryption
    RC4 256-bit encryption
    DES40 40-bit encryption
    DES 56-bit encryption
    3DES 112-bit encryption
    3DES 168-bit encryption
    AES 128-bit encryption
    AES 192-bit encryption
    AES 256-bit encryption
    MD5 crypto-checksumming
    SHA-1 crypto-checksumming
    Kerberos v5 authentication
    RADIUS authentication




sqlnet.ora Parameter
Oracle Net Manager Field
ADR_BASE
You must set this parameter manually.
DIAG_ADR_ENABLED
You must set this parameter manually.
LOG_DIRECTORY_CLIENT
Client Information: Log Directory
LOG_DIRECTORY_SERVER
Server Information: Log Directory
LOG_FILE_CLIENT
Client Information: Log File
LOG_FILE_SERVER
You must set this parameter manually.



listener.ora Parameter
Oracle Net Manager Field
ADR_BASE_listener_name
You must set this parameter manually.
DIAG_ADR_ENABLED_listener_name
You must set this parameter manually.
LOG_DIRECTORY_listener_name
LOG_FILE_listener_name
Log File



cman.ora Parameter
Description
ADR_BASE
The ADR_BASE parameter specifies the base directory for storing tracing and logging incidents.
Use this parameter when DIAG_ADR_ENABLED is set to ON.
DIAG_ADR_ENABLED
The DIAG_ADR_ENABLED parameter indicates whether ADR tracing is enabled.
When the DIAG_ADR_ENABLED parameter is set to OFF, non-ADR file tracing is used.
EVENT_GROUP
The event groups that are logged. Multiple events may be designated using a comma-delimited list. This parameter accepts the following values:
INIT_AND_TERM: initialization and termination MEMORY_OPS: memory operations CONN_HDLG: connection handling PROC_MGMT: process management REG_AND_LOAD: registration and load update WAKE_UP: events related to CMADMIN wakeup queue TIMER: gateway time outs CMD_PROC: command processing RELAY: events associated with connection control blocks
LOG_DIRECTORY
The destination directory for log files.
By default, the directory is ORACLE_HOME/network/log.
This parameter is disabled when ADR_ENABLED is on.
LOG_LEVEL
The level of logging. Four levels are supported:
off (default): no logging user: user log information admin: administrative log information support: Oracle Support Services information

Setting Logging During Control Utilities Run Time

You can set logging during control utility run time. Setting logging with a control utility does not set parameters in the *.ora files, and the setting is only valid for the control utility session.
The following settings can be set for a control utility:
  • For a listener, use the SET LOG_FILE and SET LOG_DIRECTORY commands from the Listener Control utility.
  • For an Oracle Connection Manager, use the SET LOG_DIRECTORY, SET LOG_LEVEL, and SET EVENT commands from the Oracle Connection Manager control utility.




sqlnet.ora Parameter
Oracle Net Manager Field
Description
ADR_BASE
You must set this parameter manually.
The ADR_BASE parameter specifies the base directory for storing tracing and logging incidents.
Use this parameter when DIAG_ADR_ENABLED is set to ON.
DIAG_ADR_ENABLED
You must set this parameter manually.
The DIAG_ADR_ENABLED parameter indicates whether ADR tracing is enabled.
When the DIAG_ADR_ENABLED parameter is set to OFF, non-ADR file tracing is used.
LOG_DIRECTORY_CLIENT
Client Information: Log Directory
The destination directory for the client log file. By default, the client directory is the current working directory. This parameter is disabled when ADR_ENABLED is on.
LOG_DIRECTORY_SERVER
Server Information: Log Directory
The destination directory for the database server log files. By default the server directory is ORACLE_HOME/network/log. This parameter is disabled when ADR_ENABLED is on.
LOG_FILE_CLIENT
Client Information: Log File
The name of the log file for the client. By default the log name is sqlnet.log.
LOG_FILE_SERVER
You must set this parameter manually.
The name of the log file for the database server. By default the log name is sqlnet.log.
TRACE_DIRECTORY_CLIENT
Client Information: Trace Directory
The destination directory for the client trace output. By default, the client directory is ORACLE_HOME/network/trace.
TRACE_DIRECTORY_SERVER
Server Information: Trace Directory
The destination directory for the database server trace output. By default, the server directory is ORACLE_HOME/network/trace.
TRACE_FILE_CLIENT
Client Information: Trace File
The name of the trace file for the client. By default, the trace file name is sqlnet.trc.
TRACE_FILE_SERVER
Server Information: Trace File
The name of the trace file for the database server. By default the trace file name is svr_pid.trc.
TRACE_FILELEN_CLIENT
You must set this parameter manually.
The size of the client trace files in KB. When the size is reached, the trace information is written to the next file. The number of files is specified with the TRACE_FILENO_CLIENT parameter.
TRACE_FILELEN_SERVER
You must set this parameter manually.
The size of the database server trace files in KB. When the size is reached, the trace information is written to the next file. The number of files is specified with the TRACE_FILENO_SERVER parameter.
TRACE_FILENO_CLIENT
You must set this parameter manually.
The number of trace files for client tracing. When this parameter is set along with the TRACE_FILELEN_CLIENT parameter, trace files are used in a cyclical fashion. The first file is filled, then the second file, and so on. When the last file has been filled, the first file is re-used, and so on.
The trace file names are distinguished from one another by their sequence number. For example, if the default trace file of sqlnet.trc is used, and this parameter is set to 3, then the trace files would be named sqlnet1_pid.trc, sqlnet2_pid.trc and sqlnet3_pid.trc.
In addition, trace events in the trace files are preceded by the sequence number of the file.
TRACE_FILENO_SERVER
You must set this parameter manually.
The number of trace files for database server tracing. When this parameter is set along with the TRACE_FILELEN_SERVER parameter, trace files are used in a cyclical fashion. The first file is filled, then the second file, and so on. When the last file has been filled, the first file is re-used, and so on.
The trace file names are distinguished from one another by their sequence number. For example, if the default trace file of svr_pid.trc is used, and this parameter is set to 3, then the trace files would be named svr1_pid.trc, svr2_pid.trc and svr3_pid.trc.
In addition, trace events in the trace files are preceded by the sequence number of the file.
TRACE_LEVEL_CLIENT
Client Information: Trace Level
The level of detail the trace facility records for the client.
The trace level value can either be a value within the range of 0 (zero) to 16 where 0 is no tracing and 16 represents the maximum amount of tracing) or one of the following values:
off (equivalent to 0) provides no tracing. user (equivalent to 4) traces to identify user-induced error conditions. admin (equivalent to 6) traces to identify installation-specific problems. support (equivalent to 16) provides trace information for troubleshooting information for Oracle Support Services.
TRACE_LEVEL_SERVER
Server Information: Trace Level
The level of detail the trace facility records for the database server. The trace level value can either be a value within the range of 0 (zero) to 16 where 0 is no tracing and 16 represents the maximum amount of tracing) or one of the following values:
off (equivalent to 0) provides no tracing. user (equivalent to 4) traces to identify user-induced error conditions. admin (equivalent to 6) traces to identify installation-specific problems. support (equivalent to 16) provides trace information for troubleshooting information for Oracle Support Services.
TRACE_TIMESTAMP_CLIENT
You must set this parameter manually.
A time stamp in the form of dd-mon-yyyy hh:mi:ss:mil for every trace event in the client trace file, sqlnet.trc.
TRACE_TIMESTAMP_SERVER
You must set this parameter manually.
A time stamp in the form of dd-mon-yyyy hh:mi:ss:mil for every trace event in the client trace file, sqlnet.trc.
TRACE_UNIQUE_CLIENT
Client Information: Unique Trace File Name
The value is set to on, Oracle Net creates a unique file name for each trace session by appending a process identifier to the name of each trace file generated, and enabling several files to coexist. For example, trace files named sqlnetpid.trc are created if default trace file name sqlnet.trc is used. When the value is set to off, data from a new client trace session overwrites the existing file.




TNSPING Trace Parameters

sqlnet.ora Parameter
Description
TNSPING.TRACE_DIRECTORY
The destination directory for TNSPING trace file, tnsping.trc. By default, the directory is ORACLE_HOME/network/trace.
TNSPING.TRACE_LEVEL
The level of detail the trace facility records for the TNSPING utility. The trace level value can either be a value within the range of 0 (zero) to 16 where 0 is no tracing and 16 represents the maximum amount of tracing) or one of the following values:
off (equivalent to 0) provides no tracing. user (equivalent to 4) traces to identify user-induced error conditions. admin (equivalent to 6) traces to identify installation-specific problems. support (equivalent to 16) provides trace information for troubleshooting information for Oracle Support Services.



listener.ora Parameter
Oracle Net Manager Field
Description
ADR_BASE_listener_name
You must set this parameter manually.
The ADR_BASE_listener_name parameter specifies the base directory for storing which tracing and logging incidents.
Use when DIAG_ADR_ENABLED_listener_name is set to ON.
DIAG_ADR_ENABLED_listener_name
You must set this parameter manually.
The DIAG_ADR_ENABLED_listener_name parameter indicates whether ADR tracing is enabled.
When DIAG_ADR_ENABLED_listener_name is set to OFF, non-ADR file tracing is used.
LOG_DIRECTORY_listener_name
LOG_FILE_listener_name
Log File
The destination directory and file for the log file that is automatically generated for listener events. By default the directory is ORACLE_HOME/network/log, and the file name is
listener.ora Parameter
Oracle Enterprise Manager/Oracle Net Manager Field
Description
TRACE_LEVEL_listener_name
Select a trace level/Trace Level
The level of detail the trace facility records for the listener. The trace level value can either be a value within the range of 0 (zero) to 16 where 0 is no tracing and 16 represents the maximum amount of tracing) or one of the following values:
off (equivalent to 0) provides no tracing. user (equivalent to 4) traces to identify user-induced error conditions. admin (equivalent to 6) traces to identify installation-specific problems. support (equivalent to 16) provides trace information for troubleshooting information for Oracle Support Services.
TRACE_DIRECTORY_listener_name
TRACE_FILE_listener_name
Trace File
The destination directory and file for the trace file. By default the directory is ORACLE_HOME/network/trace, and the file name is listener.trc.
TRACE_FILELEN_listener_name
You must set this parameter manually.
The size of the listener trace files in KB. When the size is reached, the trace information is written to the next file. The number of files is specified with the TRACE_FILENO_listener_name parameter
TRACE_FILENO_listener_name
You must set this parameter manually.
The number of trace files for listener tracing. When this parameter is set along with the TRACE_FILELEN_listener_name parameter, trace files are used in a cyclical fashion. The first file is filled, then the second file, and so on. When the last file has been filled, the first file is re-used, and so on.
The trace file names are distinguished from one another by their sequence number. For example, if the default trace file of listener.trc is used, and this parameter is set to 3, then the trace files would be named listener1.trc, listener2.trc and listener3.trc.
In addition, trace events in the trace files are preceded by the sequence number of the file.
TRACE_TIMESTAMP_listener_name
You must set this parameter manually.
A time stamp in the form of dd-mon-yyyy hh:mi:ss:mil for every trace event in the listener trace file.

Using the Trace Assistant to Examine Trace Files

Oracle Net Services provides a tool called the Trace Assistant to help you understand the information provided in trace files by converting existing lines of trace file text into a more readable paragraph. The Trace Assistant works only with level 16 (support) Oracle Net Services trace files.

To run the Trace Assistant, enter the following command at any command line prompt:
trcasst [options] filename


Option Description
-elevel
Displays error information. After the -e, use 0, 1, or 2 error decoding level may follow:
  • 0 or nothing translates the NS error numbers dumped from the nserror function plus lists all other errors
  • 1 displays only the NS error translation from the nserror function
  • 2 displays error numbers without translation
-la
If a connection ID exists in the NS connect packet, then the output displays the connection IDs. Connection IDs are displayed as hexadecimal, eight-byte IDs. A generated ID is created by Trace Assistant if the packet is not associated with any connection, that is, the connect packet is overwritten in the trace file. This can occur with cyclic trace files.
For each ID, the output lists the following:
  • Socket ID, if the connection has one.
  • Connect packet send or receive operation.
  • Current setting of the MULTIPLEX attribute of the DISPATCHERS parameter in the initialization parameter file. When MULTIPLEX is set to ON, session multiplexing is enabled.
  • Session ID, if MULTIPLEX is set to ON.
  • Connect data information.
Notes:
  • Do not use this option with other options.
  • The IDs generated by the Trace Assistant do not correlate with client/server trace files.
-li ID
Displays the trace for a particular ID from the -la output
Note: Only use this option with output from the -la option.
-otype
Displays the amount and type of information to be output. After the -o the following options can be used:
  • c to display summary connectivity information.
  • d to display detailed connectivity information.
  • u to display summary Two-Task Common (TTC) information.
  • t to display detailed TTC information.
  • q to display SQL commands enhancing summary TTC information. Use this option with u, such as -ouq.
Note: As output for d contains the same information as displayed for c, do not submit both c and d. If you submit both, then only output d is processed.
-s
Displays the following statistical information:
  • Total number of bytes sent and received.
  • Maximum open cursors.
  • Currently open cursors.
  • Count and ratio of operations.
  • Parsing and execution count for PL/SQL.
  • Total calls sent and received.
  • Total, average, and maximum number of bytes sent and received.
  • Total number of transports and sessions present.
  • Timestamp information, if any.
  • Sequence numbers, if any.


If no options are provided, then the default is -odt -e0 -s, which provides detailed connectivity and TTC events, error level zero (0), and statistics in the trace file



Demo:

Before you enable Network Tracing try to understand this “DIAG_ADR_ENABLED” parameter it has good significance in 11gR2.

The default value ofDIAG_ADR_ENABLED is on. Therefore, the DIAG_ADR_ENABLED parameter must explicitly be set to off in order for non-ADR tracing to be used in your sqlnet or listener.ora files..


Note:- You don’t need to bounce any services for sqlnet.ora changes:


[oracle@collabn1 admin]$ adrci

ADRCI: Release 11.2.0.1.0 - Production on Wed Sep 16 11:35:38 2015

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

ADR base = "/u01/app/oracle"
adrci> show tracefile
    diag/netcman/collabn1/cman_collabn1/trace/cman_collabn1.log
    diag/tnslsnr/collabn1/listener/trace/listener.log
    diag/tnslsnr/collabn1/cman/trace/cman.log
    diag/tnslsnr/collabn1/shaikdb/trace/shaikdb.log
adrci>


[oracle@collabn1 admin]$ vi /u01/app/oracle/diag/tnslsnr/collabn1/shaikdb/trace/shaikdb.log

Wed Sep 16 11:35:14 2015
16-SEP-2015 11:35:14 * service_update * SHAIKDB * 0
Wed Sep 16 11:35:38 2015
16-SEP-2015 11:35:38 * service_update * SHAIKDB * 0
Wed Sep 16 11:36:14 2015
16-SEP-2015 11:36:14 * service_update * SHAIKDB * 0


Create a trace directory for client & server:


[oracle@collabn1 oracle]$ ls -lrt
total 8
drwxr-xr-x 3 oracle dba      4096 Sep 16 10:56 client
drwxr-xr-x 3 oracle oinstall 4096 Sep 16 10:58 server


Enable tracing on the server:

vi $TNS_ADMIN/sqlnet.ora

#Logging details
DIAG_ADR_ENABLED=OFF
TRACE_DIRECTORY_SERVER=/u02/app/oracle/server/trace
TRACE_FILE_SERVER=SHAIKDB_SERVER.trc
TRACE_LEVEL_SERVER=admin
TRACE_TIMESTAMP_SERVER=ON
                          

[oracle@collabn1 diag]$ ls -lrt /u02/app/oracle/server/trace
total 92
-rw-r----- 1 oracle dba 36450 Sep 16 11:30 shaikdb_server_23228.trc
-rw-r----- 1 oracle dba 38633 Sep 16 11:30 shaikdb_server_23282.trc
-rw-r----- 1 oracle dba  5137 Sep 16 11:31 shaikdb_server_24305.trc
-rw-r----- 1 oracle dba  3062 Sep 16 11:31 shaikdb_server_24307.trc
-rw-r----- 1 oracle dba  3062 Sep 16 11:33 shaikdb_server_24879.trc

With TRACE_LEVE_SERVER=admin

vi /u02/app/oracle/server/trace/shaikdb_server_23282.trc

[16-SEP-2015 11:30:26:273] --- TRACE CONFIGURATION INFORMATION FOLLOWS ---
[16-SEP-2015 11:30:26:273] New trace stream is /u02/app/oracle/server/trace/shaikdb_server_23282.trc
[16-SEP-2015 11:30:26:273] New trace level is 6
[16-SEP-2015 11:30:26:273] --- TRACE CONFIGURATION INFORMATION ENDS ---
[16-SEP-2015 11:30:26:273] --- PARAMETER SOURCE INFORMATION FOLLOWS ---
[16-SEP-2015 11:30:26:273] Attempted load of system pfile source /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/sqlnet.ora
[16-SEP-2015 11:30:26:273] Parameter source loaded successfully
[16-SEP-2015 11:30:26:273]
[16-SEP-2015 11:30:26:273]  -> PARAMETER TABLE LOAD RESULTS FOLLOW <-
[16-SEP-2015 11:30:26:273] Successful parameter table load
[16-SEP-2015 11:30:26:273]  -> PARAMETER TABLE HAS THE FOLLOWING CONTENTS <-
[16-SEP-2015 11:30:26:273]   DIAG_ADR_ENABLED = OFF
[16-SEP-2015 11:30:26:273]   TRACE_DIRECTORY_SERVER = /u02/app/oracle/server/trace
[16-SEP-2015 11:30:26:273]   TCP.INVITED_NODES = (collabn1.shaiksameer, collabn2.shaiksameer)
[16-SEP-2015 11:30:26:273]   TRACE_FILE_CLIENT = SHAIKDB_CLIENT.trc



With TRACE_LEVE_SERVER=user

[16-SEP-2015 11:57:09:415] --- TRACE CONFIGURATION INFORMATION FOLLOWS ---
[16-SEP-2015 11:57:09:415] New trace stream is /u02/app/oracle/server/trace/shaikdb_server_2243.trc
[16-SEP-2015 11:57:09:415] New trace level is 4
[16-SEP-2015 11:57:09:415] --- TRACE CONFIGURATION INFORMATION ENDS ---
[16-SEP-2015 11:57:09:415] --- PARAMETER SOURCE INFORMATION FOLLOWS ---
[16-SEP-2015 11:57:09:415] Attempted load of system pfile source /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/sqlnet.ora
[16-SEP-2015 11:57:09:415] Parameter source loaded successfully



With TRACE_LEVE_SERVER=support

[16-SEP-2015 12:01:42:191] --- TRACE CONFIGURATION INFORMATION FOLLOWS ---
[16-SEP-2015 12:01:42:191] New trace stream is /u02/app/oracle/server/trace/shaikdb_server_4386.trc
[16-SEP-2015 12:01:42:191] New trace level is 16
[16-SEP-2015 12:01:42:191] --- TRACE CONFIGURATION INFORMATION ENDS ---
[16-SEP-2015 12:01:42:191] --- PARAMETER SOURCE INFORMATION FOLLOWS ---
[16-SEP-2015 12:01:42:191] Attempted load of system pfile source /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/sqlnet.ora
[16-SEP-2015 12:01:42:191] Parameter source loaded successfully
[16-SEP-2015 12:01:42:191]



Enable Listener tracing:

Since you could have multiple listeners in listener.ora file  you have to explicitly call out the name of the “listener” while setting the tracing parameters in listener.ora.


Caveat with listener is you have to change the DIAG_ADR_ENABLED_LISTENER_NAME=OFF

vi listener.ora
DIAG_ADR_ENABLED_SHAIKDB=OFF
TRACE_DIRECTORY_shaikdb=/u02/app/oracle/listener/trace
TRACE_FILE_shaikdb=SHAIKDB_listener.trc
TRACE_LEVEL_shaikdb=admin
TRACE_TIMESTAMP_shaikdb=ON


Before the bounce of listener:

[oracle@collabn1 ~]$ lsnrctl status shaikdb

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 12:30:19

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     SHAIKDB
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-SEP-2015 00:34:02
Uptime                    2 days 11 hr. 56 min. 16 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/shaikdb/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 2 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
 Instance "SHAIKDB", status READY, has 1 handler(s) for this service...
The command completed successfully


TO:

[oracle@collabn1 ~]$ lsnrctl reload shaikdb

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 14:21:41

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
The command completed successfully


[oracle@collabn1 ~]$ lsnrctl status shaikdb

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 14:21:49

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     shaikdb
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 13:58:56
Uptime                    0 days 0 hr. 22 min. 52 sec
Trace Level               admin
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u02/app/oracle/listener/trace/shaikdb.log
Listener Trace File       /u02/app/oracle/listener/trace/shaikdb_listener.trc
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 1 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


Trace files:

[oracle@collabn1 admin]$ cd /u02/app/oracle/listener/trace/

[oracle@collabn1 trace]$ ls -lrt
total 68
-rw-r----- 1 oracle oinstall  3033 Sep 16 14:24 shaikdb.log
-rw-r----- 1 oracle oinstall 62762 Sep 16 14:24 shaikdb_listener.trc


[oracle@collabn1 trace]$ vi shaikdb_listener.trc

NSLSNR for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 14:21:41

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

[16-SEP-2015 14:21:41:900] --- TRACE CONFIGURATION INFORMATION FOLLOWS ---
[16-SEP-2015 14:21:41:900] New trace stream is /u02/app/oracle/listener/trace/shaikdb_listener.trc
[16-SEP-2015 14:21:41:900] New trace level is 6
[16-SEP-2015 14:21:41:900] --- TRACE CONFIGURATION INFORMATION ENDS ---
[16-SEP-2015 14:21:41:900] --- LOG CONFIGURATION INFORMATION FOLLOWS ---
[16-SEP-2015 14:21:41:900] Existing log stream is identical to desired "/u02/app/oracle/listener/trace/shaikdb.log"; ignoring alter
[16-SEP-2015 14:21:41:900] --- LOG CONFIGURATION INFORMATION ENDS ---
------
----

[16-SEP-2015 14:25:00:120] nsevfnt: cxd: 0xa62f50 stage 0: NS events set:
       READY FOR SEND
[16-SEP-2015 14:25:00:120] nsevrec: event is 0x10, on 4
[16-SEP-2015 14:25:00:120] nsevwait: 1 posted event(s)
[16-SEP-2015 14:25:00:120] nsglhe: entry
[16-SEP-2015 14:25:00:120] nsglrohe: entry
[16-SEP-2015 14:25:00:120] nsevmute: cid=4
[16-SEP-2015 14:25:00:120] nsglrohe: exit
[16-SEP-2015 14:25:00:120] nsglhe: exit
[16-SEP-2015 14:25:00:120] nsevwait: 3 registered connection(s)
[16-SEP-2015 14:25:00:120] nsevwait: 0 pre-posted event(s)
[16-SEP-2015 14:25:00:120] nsevwait: waiting for transport event (1 thru 4)...

Manage Oracle network processes

$
0
0
Manage Oracle network processes is all about lsnrctl utlity:

[oracle@collabn1 ~]$ lsnrctl

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 19:25:19

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

Welcome to LSNRCTL, type "help" for information.

LSNRCTL> help
The following operations are available
An asterisk (*) denotes a modifier or extended command:

start               stop                status            
services            version             reload            
save_config         trace               spawn             
change_password     quit                exit              
set*                show*             

LSNRCTL>

LSNRCTL> stop
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
The command completed successfully


LSNRCTL> start
Starting /u01/app/oracle/product/11.2.0.2/SHAIKPROD/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1621)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 19:26:36
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1621)))
Services Summary...
Service "MYDB" has 1 instance(s).
 Instance "MYDB", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_dgmgrl.shaiksameer" has 1 instance(s).
 Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 19:26:36
Uptime                    0 days 0 hr. 0 min. 2 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1621)))
Services Summary...
Service "MYDB" has 1 instance(s).
 Instance "MYDB", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_dgmgrl.shaiksameer" has 1 instance(s).
 Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL>

LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
Services Summary...
Service "MYDB" has 1 instance(s).
 Instance "MYDB", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
Service "orcl_dgmgrl.shaiksameer" has 1 instance(s).
 Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
    Handler(s):
     "DEDICATED" established:0 refused:0
        LOCAL SERVER
The command completed successfully


LSNRCTL> version
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
   TNS for Linux: Version 11.2.0.1.0 - Production
   Unix Domain Socket IPC NT Protocol Adaptor for Linux: Version 11.2.0.1.0 - Production
   Oracle Bequeath NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
   TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production,,
The command completed successfully


LSNRCTL> reload
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
The command completed successfully
LSNRCTL>


SPAWN

Purpose
To start a program stored on the computer on which the listener is running, and which is listed with an alias in the listener.ora file.

For example:
nstest = (PROGRAM=(NAME=nstest)(ARGS=test1)(ENVS='ORACLE_HOME=/usr/oracle'))
Example
This program can then be spawned off using the following command:
lsnrctl SPAWN listener_name nstest

TRACE

Purpose
To turn on tracing for the listener.

This command has the same functionality as SET TRC_LEVEL command.


level: One of the following trace levels:
  • off for no trace output
  • user for user trace information
  • admin for administration trace information
  • support for Oracle Support Services trace information

LSNRCTL> trace admin
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
Opened trace file: /u01/app/oracle/diag/tnslsnr/collabn1/listener/trace/ora_11154_140186301859584.trc
The command completed successfully

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 19:26:36
Uptime                    0 days 0 hr. 9 min. 32 sec
Trace Level               admin
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listener Trace File       /u01/app/oracle/diag/tnslsnr/collabn1/listener/trace/ora_11154_140186301859584.trc
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1621)))
Services Summary...
Service "MYDB" has 1 instance(s).
 Instance "MYDB", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_dgmgrl.shaiksameer" has 1 instance(s).
 Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
No changes to save for LISTENER.
The command completed successfully


LSNRCTL> show
The following operations are available after show
An asterisk (*) denotes a modifier or extended command:

rawmode                            displaymode                      
rules                              trc_file                         
trc_directory                      trc_level                        
log_file                           log_directory                    
log_status                         current_listener                 
inbound_connect_timeout            startup_waittime                 
snmp_visible                       save_config_on_stop              
dynamic_registration               enable_global_dynamic_endpoint   
oracle_home                        pid                              

LSNRCTL> set trc_level admin
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
LISTENER parameter "trc_level" set to admin
The command completed successfully


LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
Saved LISTENER configuration parameters.
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Old Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.bak
The command completed successfully

/u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin

-rw-r--r-- 1 oracle oinstall 1306 Sep 16 14:20 listener.bak
-rw-r--r-- 1 oracle oinstall 1428 Sep 16 19:41 listener.ora


/u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin
[oracle@collabn1 admin]$ vi listener.ora

#----ADDED BY TNSLSNR 16-SEP-2015 19:41:20---
TRACE_LEVEL_LISTENER = admin
#--------------------------------------------


LSNRCTL> show pid
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
PID=(11154)
The command completed successfully
LSNRCTL>


LSNRCTL> show log_file
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
LISTENER parameter "log_file" set to /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
The command completed successfully

LSNRCTL> show snmp_visible
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
LISTENER parameter "snmp_visible" set to OFF
The command completed successfully

LSNRCTL> show dynamic_registration
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
LISTENER parameter "dynamic_registration" set to ON
The command completed successfully

LSNRCTL> show startup_waittime
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
LISTENER parameter "startup_waittime" set to 0
The command completed successfully

LSNRCTL> set trc_level off
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
LISTENER parameter "trc_level" set to off
The command completed successfully


LSNRCTL> save_config
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
Saved LISTENER configuration parameters.
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Old Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.bak
The command completed successfully


[oracle@collabn1 admin]$ vi listener.ora

#----ADDED BY TNSLSNR 16-SEP-2015 19:41:20---
TRACE_LEVEL_LISTENER = off
#--------------------------------------------

Configure the network environment to allow connections to multiple databases

$
0
0
How to configure the services with the listener dynamically and statically.

It is possible to start and use a listener with no configuration. This default listener has a name of LISTENER, supports no services on startup, and listens on the following TCP/IP protocol address:


[oracle@collabn1 admin]$ ps -aef| grep tns
root        15     2  0 Sep13 ?        00:00:00 [netns]
oracle   25719 15337  0 21:20 pts/4    00:00:00 grep tns


[oracle@collabn1 admin]$ netstat -an | grep 1521
unix  3      [ ]         STREAM     CONNECTED     160152191
unix  3      [ ]         STREAM     CONNECTED     160152192
unix  3      [ ]         STREAM     CONNECTED     160152193
unix  3      [ ]         STREAM     CONNECTED     160152194


No listener.ora or sqlnet.ora

[oracle@collabn1 admin]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 21:20:12

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

Starting /u01/app/oracle/product/11.2.0.2/SHAIKPROD/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Log messages written to /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 21:20:12
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))
The listener supports no services
The command completed successfully


[oracle@collabn1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 21:22:43

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 21:20:12
Uptime                    0 days 0 hr. 2 min. 30 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))
The listener supports no services
The command completed successfully


These services can be configured statically in the listener.ora file or they can be dynamically registered with the listener. This dynamic registration feature is calledservice registration. The registration is performed by thePMON process, an instance background process of each database instance that is configured in the database initialization parameter file. Dynamic service registration does not require any manual configuration in the listener.ora file.


When services are configured statically, a listener starts a dedicated server when it receives a client request. If the instance is not up, then the server returns an Oracle not available error message.


If you expect the listener to handle large volumes of concurrent connection requests, then you can specify a listener queue size for its TCP/IP or IPC listening endpoints.



Setting Initialization Parameters for Dynamic Service Registration

To ensure service registration works properly, the initialization parameter file should contain the following parameters:
  • SERVICE_NAMES for the database service name
  • INSTANCE_NAME for the instance name
  • LOCAL_LISTENER for the local listener
  • REMOTE_LISTENER for the remote listener, if any


Demo for dynamic registration:

Without any listener.ora or sqlnet.ora files in the $TNS_ADMIN:


SHAIKDB>alter system set local_listener='(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))';

System altered.

SHAIKDB>!    
     
[oracle@collabn1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 21:35:30

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 21:20:12
Uptime                    0 days 0 hr. 15 min. 17 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))
Services Summary...
Service "SHAIKDB.SHAIKSAMEER" has 1 instance(s).
 Instance "SHAIKDB", status READY, has 1 handler(s) for this service...
The command completed successfully

Below are the parameters on my instance:

SHAIKDB>show parameter listener

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
listener_networks            string
local_listener                string     (DESCRIPTION=(ADDRESS=(PROTOCO
                       L=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))

remote_listener             string


SHAIKDB>show parameter instance_name

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
instance_name                string     SHAIKDB

SHAIKDB>show parameter service_names

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
service_names                string     shaikdb
SHAIKDB>




Let’s create another database MYDB and register it with the listener dynamically.

[oracle@collabn1 ~]$ dbca -createdatabase -silent -sid MYDB -gdbname MYDB -templatename General_Purpose.dbc -datafiledestination /u01/app/oracle/mydb
Enter SYS user password:
Enter SYSTEM user password:
Copying database files
1% complete
3% complete
35% complete
Creating and starting Oracle instance
37% complete
42% complete
47% complete
52% complete
53% complete
56% complete
58% complete
Registering database with Oracle Restart
64% complete
Completing Database Creation
68% complete
71% complete
75% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/MYDB/MYDB.log" for further details.


After the database creation listener automatically registered the database dynamically.

[oracle@collabn1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 21:55:10

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 21:20:12
Uptime                    0 days 0 hr. 34 min. 57 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1521)))
Services Summary...
Service "MYDB" has 1 instance(s).
 Instance "MYDB", status READY, has 2 handler(s) for this service...
Service "MYDBXDB" has 1 instance(s).
 Instance "MYDB", status READY, has 1 handler(s) for this service...
Service "SHAIKDB.SHAIKSAMEER" has 1 instance(s).
 Instance "SHAIKDB", status READY, has 1 handler(s) for this service...
The command completed successfully


Instances parameters for MYDB:
SHAIKDB>show parameter instance_name

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
instance_name                string     MYDB
SHAIKDB>show parameter service_name

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
service_names                string     MYDB
SHAIKDB>show parameter local_listener

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
local_listener                string      (ADDRESS=(PROTOCOL=TCP)(HOST=
                       192.168.78.61)(PORT=1521))
SHAIKDB>show parameter remote_listener

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
remote_listener             string      collabn-cluster-scan.shaiksam
                       eer:1521


Now let’s do the static registration:


Stop the default listener:
[oracle@collabn1 ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 22:09:36

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully

Let’s create the listener.ora file and configure MYDB to listen on 1621 and SHAIKDB on 1522

[oracle@collabn1 admin]$ vi listener.ora

SID_LIST_SHAIKDB =
 (SID_LIST =
    (SID_DESC =
     (GLOBAL_DBNAME = SHAIKDB.shaiksameer)
     (SID_NAME = SHAIKDB)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0.2/SHAIKPROD)
    )
 )

SID_LIST_LISTENER =
 (SID_LIST =
    (SID_DESC =
     (GLOBAL_DBNAME = orcl_dgmgrl.shaiksameer)
     (SID_NAME = orcl)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0.2/SHAIKPROD)
    )
    (SID_DESC =
     (GLOBAL_DBNAME = MYDB)
     (SID_NAME = MYDB)
     (ORACLE_HOME = /u01/app/oracle/product/11.2.0.2/SHAIKPROD)
    )
 )

LISTENER =
 (DESCRIPTION_LIST =
    (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1621))
    )
 )

SHAIKDB =
 (DESCRIPTION_LIST =
    (DESCRIPTION =
     (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1522))
    )
 )


[oracle@collabn1 admin]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 22:13:46

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

Starting /u01/app/oracle/product/11.2.0.2/SHAIKPROD/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1621)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1621)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 22:13:46
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/collabn1/listener/alert/log.xml
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1621)))
Services Summary...
Service "MYDB" has 1 instance(s).
 Instance "MYDB", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl_dgmgrl.shaiksameer" has 1 instance(s).
 Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


[oracle@collabn1 admin]$ lsnrctl start shaikdb

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 22:13:55

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

Starting /u01/app/oracle/product/11.2.0.2/SHAIKPROD/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Log messages written to /u02/app/oracle/listener/trace/shaikdb.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1522)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=collabn1.shaiksameer)(PORT=1522)))
STATUS of the LISTENER
------------------------
Alias                     shaikdb
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                16-SEP-2015 22:13:55
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin/listener.ora
Listener Log File         /u02/app/oracle/listener/trace/shaikdb.log
Listening Endpoints Summary...
 (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=collabn1.shaiksameer)(PORT=1522)))
Services Summary...
Service "SHAIKDB.shaiksameer" has 1 instance(s).
 Instance "SHAIKDB", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


[oracle@collabn1 admin]$ tnsping mydb

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 22:15:34

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MYDB)))
OK (0 msec)


[oracle@collabn1 admin]$ tnsping shaikdb

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 16-SEP-2015 22:15:39

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = SHAIKDB.shaiksameer)))
OK (0 msec)


[oracle@collabn1 admin]$ sqlplus test/test@shaikdb

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 16 22:15:50 2015

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


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

SHAIKDB>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options


[oracle@collabn1 admin]$ sqlplus system@mydb

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 16 22:16:10 2015

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

Enter password:

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

SHAIKDB>show parameter db_name

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_name                 string     MYDB


Documentation:
Oracle Database Net Services Reference --> Chapter-1
 

Use configurationless connections

$
0
0

Below we will discuss how to make a database connection without using tnsnames.ora files:

Using the Easy Connect Naming Method

The Easy Connect naming method eliminates the need for service name lookup in the tnsnames.ora files for TCP/IP environments. In fact, no naming or directory system is required if you use this method.

CONNECT username@[//]host[:port][/service_name][:server][/instance_name]
Enter password: password
The connect identifier converts to the following connect descriptor:
(DESCRIPTION=
 (ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=port))
 (CONNECT_DATA=
   (SERVICE_NAME=service_name)
   (SERVER=server)
   (INSTANCE_NAME=instance_name)))


//
Specify // for a URL.
For URL or JDBC connections, it is required that the connect identifier is preceded by a double-slash (//). For example:
scott@//sales-server
Enter password: password
For SQL connections, it is optional that the connect identifier is preceded by a double-slash (//). For example, the following connect strings are semantically equivalent:
SQL> CONNECT scott@sales-server
Enter password: password
SQL> CONNECT scott@//sales-server
Enter password: password
host
Required. Specify the host name or IP address of the database host computer.
The host name is domain-qualified if the local operating system configuration specifies a domain.
You may use an IPv4 or IPv6 address as a value. IPv6 addresses or host names that resolve to IPv6 addresses must be enclosed in square brackets, as in [2001:0DB8:0:0::200C:417A] and [salesdb].
port
Optional. Specify the listening port.
The default is 1521.
service_name
Optional. Specify the service name of the database.
If a user specifies a service name, then the listener connects the user to that specific database. Otherwise, the listener connects to the database specified by the DEFAULT_SERVICE_listener_name parameter in the listener.ora file. If DEFAULT_SERVICE_listener_name is not configured for the listener and a service name is not explicitly specified by the user as part of the Easy Connect syntax, then the listener returns an error.
server
Optional. Specify the database server type to use.
This parameter instructs the listener to connect the client to a specific type of service handler.
The values for the server parameter are dedicated, shared, and pooled. If server is not specified in the Easy Connect syntax, then the type of server is chosen by the listener (shared server if configured, otherwise a dedicated server is used).
Note: In Oracle Call Interface documentation, server is referred to as connect_type.
instance_name
Optional. Used to identify the database instance to access.
The instance name can be obtained from the INSTANCE_NAME parameter in the initialization parameter file.

Demo:


@[<net_service_name> | [//]Host[:Port]/<service_name>]

host=collabn1.shaiksameer
service_name=shaikdb.shaiksameer
port=1522
username=test

oracle@collabn1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 16 22:38:53 2015

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

SHAIKDB>connect test@'//collabn1.shaiksameer:1522/shaikdb.shaiksameer'
Enter password:
Connected.

or

[oracle@collabn1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 16 22:38:53 2015

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

SHAIKDB>connect test@'collabn1.shaiksameer:1522/shaikdb.shaiksameer'
Enter password:
Connected.
SHAIKDB>


or

If the database is listening on the default port then you can ignore the port number during the connection:

[oracle@collabn1 ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 16 22:41:50 2015

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

SHAIKDB>connect system@'//collabn1.shaiksameer/mydb'
Enter password:
Connected.
SHAIKDB>

Unable to get property values from properties file of the Online patch.

$
0
0
Unable to get property values from properties file of the Online patch.
The node name is "collabn1".


While trying to rollback a patch I am getting above error:

[oracle@collabn1 13467683]$  opatch rollback -id 13467683 -connectstring "SHAIKPRD1:system:test123:collabn1"
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_20-49-34PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

RollbackSession rolling back interim patch '13467683' from OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.

Running prerequisite checks...
Prerequisite check "CheckRollbackSid" failed.

Patch ID: 13467683

The details are:

Unable to get property values from properties file of the Online patch.
The node name is "collabn1".

RollbackSession failed during prerequisite checks: Prerequisite check "CheckRollbackSid" failed.
System intact, OPatch will not attempt to restore the system

OPatch failed with error code 74


[oracle@collabn1 13467683]$


Fix:
Missing OnlinePatch.properties file under $ORACLE_HOME/.patch_storage dir

[oracle@collabn1 SHAIKPROD]$ cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/

[oracle@collabn1 .patch_storage]$ ls -lrt
total 8
drwxr-xr-x 3 oracle oinstall 4096 Sep 18 20:46 13467683_Feb_5_2012_00_15_49
-rw-r--r-- 1 oracle oinstall   25 Sep 18 20:49 db_status.sql
-rw-r--r-- 1 oracle oinstall    0 Sep 18 20:49 patch_free

Create the OnlinePatch.properties

[oracle@collabn1 .patch_storage]$ vi OnlinePatch.properties
#Fri Sep 18 20:54:39 EDT 2015
PATCH_ID=13467683
13467683_ONLINE_SID=SHAIKPRD1

Rerun the opatch:

[oracle@collabn1 .patch_storage]$  opatch rollback -id 13467683 -connectstring "SHAIKPRD1:system:test123:collabn1"

Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_20-54-33PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

RollbackSession rolling back interim patch '13467683' from OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.

Backing up files affected by the patch '13467683' for restore. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
The patch will be removed from active database instances.
Disabling and removing online patch 'bug13467683.pch', on database 'SHAIKPRD1'

RollbackSession removing interim patch '13467683' from inventory

Patching in all-node mode.

Updating nodes 'collabn2'
  Rollback-related files are:
    FR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt"
    DR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt"
    FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt"
    MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt"
    RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt" with actual path.
Removing files on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt" with actual path.
Removing directories on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...

OPatch succeeded.

The Oracle Home does not exist in Central InventoryUtilSession failed:

$
0
0
While applying the patch I was getting below error:

orporation.  All rights reserved.UTIL sessionOracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPRODCentral Inventory : /u01/app/oraInventory   from           : /etc/oraInst.locOPatch version    : 11.1.0.6.6OUI version       : 11.2.0.1.0OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/ouiLog file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_21-03-18PM.logPatch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txtList of Homes on this system:  Home name= OraGI12Home1, Location= "/u01/app/oracle/product/12.1.0/grid"OPatch failed with error code 73OPatchSession cannot load inventory for the given Oracle Home /u01/app/oracle/product/11.2.0.2/SHAIKPROD. Possible causes are:   No read or write permission to ORACLE_HOME/.patch_storage   Central Inventory is locked by another OUI instance   No read permission to Central Inventory   The lock file exists in ORACLE_HOME/.patch_storage   The Oracle Home does not exist in Central InventoryUtilSession failed: OracleHomeInventory gets null oracleHomeInfo :failed
System intact, OPatch will not attempt to restore the system

Fix:
Verify the file under $INV_LOC/ContentsXML -> inventory.xml has the ORACLE_HOME details that you are trying to patch:

[oracle@collabn1 SHAIKPROD]$  vi /etc/oraInst.loc
inventory_loc=/u01/app/oraInventory
inst_group=oinstall

Below ORACLE_HOME is missing....modify the file and retry the patch:

 vi /u01/app/oraInventory/ContentsXML/inventory.xml
from:
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2014, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
   <SAVED_WITH>12.1.0.2.0</SAVED_WITH>
   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
   <NODE_LIST>
      <NODE NAME="collabn1"/>
      <NODE NAME="collabn2"/>
   </NODE_LIST>
</HOME>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>

to:
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/u01/app/oracle/product/12.1.0/grid" TYPE="O" IDX="1" CRS="true">
   <NODE_LIST>
      <NODE NAME="collabn1"/>
      <NODE NAME="collabn2"/>
   </NODE_LIST>
</HOME>
<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0.2/SHAIKPROD" TYPE="O" IDX="2">
   <NODE_LIST>
      <NODE NAME="collabn1"/>
      <NODE NAME="collabn2"/>
   </NODE_LIST>



[oracle@collabn1 .patch_storage]$  opatch rollback -id 13467683 -connectstring "SHAIKPRD1:system:test123:collabn1"
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_21-18-49PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

RollbackSession rolling back interim patch '13467683' from OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.

Backing up files affected by the patch '13467683' for restore. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
The patch will be removed from active database instances.
Disabling and removing online patch 'bug13467683.pch', on database 'SHAIKPRD1'

RollbackSession removing interim patch '13467683' from inventory

Patching in all-node mode.

Updating nodes 'collabn2'
   Rollback-related files are:
     FR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt"
     DR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt"
     FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt"
     MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt"
     RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt" with actual path.
Removing files on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt" with actual path.
Removing directories on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...

OPatch succeeded.

Use OPatch to install a patch - part1

$
0
0
how to use OPatch to install a patch:

To debug the opatch session:
export OPATCH_DEBUG=TRUE
To disable:
unset OPATCH_DEBUG or export OPATCH_DEBUG=FALSE

[oracle@collabn1 13467683]$ opatch query -h
DESCRIPTION
       This operation loads and prints out various information about a patch.
       Parameter patch_location points to where a patch is located.  
       For example, if you specify "path", there should be sub-dir.
       "etc/config" under "path".



[oracle@collabn1 13467683]$ opatch query
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_23-01-49PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

--------------------------------------------------------------------------------
Patch created on 5 Feb 2012, 00:15:49 hrs PST8PDT
Need to shutdown Oracle instances: true
Patch is roll-backable: true
Patch is a rolling patch: true
Patch has sql related actions: false
Patch is an online patch: false
Patch is a portal patch: false

List of platforms supported:
  226: Linux x86-64

List of bugs to be fixed:
  13467683: JOIN OF TEMP AND PERMANENT TABLES IN RAC MIGHT CAUSE CORRUPTION OF PERMANENT TBL

This patch is a "singleton" patch.

List of executables affected:
  ORACLE_HOME/bin/oracle

List of optional components:
  oracle.rdbms:  11.2.0.1.0

List of optional actions:
  Update /u01/app/oracle/product/11.2.0.2/SHAIKPROD/lib/libserver11.a with /kcbz.o
  cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib
    ; make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD

 Possible XML representation of the patch:
<ONEOFF REF_ID="13467683" ROLLBACK="T" XML_INV_LOC="oneoffs/13467683/" ACT_INST_VER="11.2.0.1.0" INSTALL_TIME="2015.Sep.18 23:01:49 EDT">
  <DESC></DESC>
  <REF_LIST>
     <REF NAME="oracle.rdbms" VER="11.2.0.1.0" HOME_IDX="0"/>
  </REF_LIST>
  <BUG_LIST>
    <BUG>13467683</BUG>
  </BUG_LIST>
  <FILE_LIST/>
</ONEOFF>

--------------------------------------------------------------------------------

OPatch succeeded.


[oracle@collabn1 13467683]$ opatch prereq CheckApplicable -ph /media/sf_stage/13467683/
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

PREREQ session

Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_23-12-20PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

Invoking prereq "checkapplicable"

Prereq "checkApplicable" for patch 13467683 passed.

OPatch succeeded.


Demo:

Below I will apply the patch  ONLINE to the 2 node RAC database .

Patch 13467683 is staged under /media/sf_stage/

Patch details:
 bug number="13467683"
description="JOIN OF TEMP AND PERMANENT TABLES IN RAC MIGHT CAUSE CORRUPTION OF PERMANENT TBL

Database details:
[oracle@collabn2 ~]$ srvctl start database -d SHAIKPRD

[oracle@collabn2 ~]$ srvctl status database -d SHAIKPRD
Instance SHAIKPRD1 is running on node collabn1
Instance SHAIKPRD2 is running on node collabn2



[oracle@collabn1 ~]$ ls -lrt /media/sf_stage/p13467683_112010_Linux-x86-64.zip
-rwxrwx--- 1 root vboxsf 509191 Sep 18 20:11 /media/sf_stage/p13467683_112010_Linux-x86-64.zip


SHAIKDB>select banner from v$version ;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0    Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production


[oracle@collabn1 ~]$ opatch lsinventory -detail
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_19-59-43PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/lsinv/lsinventory2015-09-18_19-59-43PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.1.0
There are 1 products installed in this Oracle Home.


Installed Products (134):

Agent Required Support Files                                         10.2.0.4.2
Assistant Common Files                                               11.2.0.1.0
Bali Share                                                           1.1.18.0.0
Buildtools Common Files                                              11.2.0.1.0
Character Set Migration Utility                                      11.2.0.1.0
Cluster Verification Utility Common Files                            11.2.0.1.0
Database Configuration and Upgrade Assistants                        11.2.0.1.0
Database SQL Scripts                                                 11.2.0.1.0
Database Workspace Manager                                           11.2.0.1.0
Deinstallation Tool                                                  11.2.0.1.0

There are 134 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


Rac system comprising of multiple nodes
 Local node = collabn1
 Remote node = collabn2

--------------------------------------------------------------------------------

OPatch succeeded.



[oracle@collabn1 ~]$ opatch -help
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Usage: opatch [ -help ] [ -r[eport] ] [ command ]

           command := apply
                      lsinventory
                      napply
                      nrollback
                      rollback
                      query
                      version
                      prereq
                      util

example:
  'opatch -help'
  'opatch apply -help'
  'opatch lsinventory -help'
  'opatch napply -help'
  'opatch nrollback -help'
  'opatch rollback -help'
  'opatch prereq -help'
  'opatch util -help'
  

[oracle@collabn1 ~]$ opatch apply -help
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


DESCRIPTION
    This operation applies an interim patch to an ORACLE_HOME from
    the current directory. The patch location can specified using
    the parameter patch_location.

SYNTAX
opatch apply  [-connectString  <List of connect strings>]
             [-delay <value> ] [ -force ]
             [-init <parameters for the init script in escaped double
              quotes> [-opatch_init_end] ]
             [-invPtrLoc <Path to oraInst.loc> ]
             [-jre <LOC> ] [-local ] [-local_node <Local node name>]
             [-minimize_downtime ] [-no_bug_superset ]
         [-no_inventory ] [-no_relink]
             [-no_sysmod] [-ocmrf <Response file location> ]
             [-oh <ORACLE_HOME> ]
             [-post <parameters for the post script in escaped
              quotes> [-opatch_post_end] ]
             [-pre <parameters for the pre script
              in escaped double quotes> [-opatch_pre_end] ]
             [-property_file <Path to property file>]
             [-ptlConnect <portal connect string>]
             [-ptlPassword <portal password>]
             [-ptlSchema <portal schema>]
             [-remote_nodes <List of remote nodes (node1,node2)>]
             [-retry <value ] [-runSql ]
             [silent ] [-sqlScript <path of the sql file>] [-verbose ]
             [ <Patch Location> ]


[oracle@collabn1 sf_stage]$ unzip p13467683_112010_Linux-x86-64.zip

[oracle@collabn1 sf_stage]$ cd 13467683/
[oracle@collabn1 13467683]

[oracle@collabn1 13467683]$ ls -lrt
total 12
-rwxrwx--- 1 root vboxsf 8863 Feb  5  2012 README.txt
drwxrwx--- 1 root vboxsf  136 Feb  5  2012 online
drwxrwx--- 1 root vboxsf  102 Feb  5  2012 files
drwxrwx--- 1 root vboxsf  136 Feb  5  2012 etc
[oracle@collabn1 13467683]$

 -connectString
             This option can be used to specify the list of database
             instances on which the patch needs to be applied. The
             value for this option is specified as per the following
             syntax "SID:User:Passwd:Node". The SID is a must, others
             can be ignored, OPatch takes default values for it.
             Ex: oracle:dba:dba:mymachine,oracle1:::
             NOTE: If the system is not part of RAC setup, then to
             patch just the local node, provide the node name as
             empty string.


[oracle@collabn1 ~]$ cd /media/sf_stage/13467683/
[oracle@collabn1 13467683]$ opatch apply online -connectstring "SHAIKPRD1:system:test123:collabn1,SHAIKPRD2:system:test123:collabn2"
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_21-19-40PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt


The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.
ApplySession applying interim patch '13467683' to OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.

Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '13467683' for restore. This might take a while...
Backing up files affected by the patch '13467683' for rollback. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
The patch will be installed on active database instances.
Installing and enabling the online patch 'bug13467683.pch', on database 'SHAIKPRD1'.

ApplySession adding interim patch '13467683' to inventory

Verifying the update...
Inventory check OK: Patch ID 13467683 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 13467683 are present in Oracle Home.

Patching in all-node mode.

Updating nodes 'collabn2'
  Apply-related files are:
    FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt"
    DP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt"
    MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt"
    RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt" with actual path.
Running command on remote node 'collabn2':
/u01/app/oracle/product/11.2.0.2/SHAIKPROD/bin/mkpatch -fixup /u01/app/oracle/product/11.2.0.2/SHAIKPROD/hpatch/bug13467683.pch /u01/app/oracle/product/11.2.0.2/SHAIKPROD/bin/oracle

Installing and enabling the online patch 'bug13467683.pch', on database 'SHAIKPRD2' on node 'collabn2'.


OPatch succeeded.


If you have multiple databases installed on the same ORACLE_HOME then use ” util enableonlinepatch”
To apply the patch on the SID2: which is SHAIKDB installed on the same node as collabn1 and shares the same ORACLE_HOME as database SHAIKPRD.



[oracle@collabn1 13467683]$ opatch util enableonlinepatch -connectstring SHAIKDB -id 13467683
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_22-26-10PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

Invoking utility "enableonlinepatch"
Installing and enabling the online patch 'bug13467683.pch', on database 'SHAIKDB'.


OPatch succeeded.

To rollback the patch from individual nodes:

[oracle@collabn2 .patch_storage2]$ opatch rollback -id 13467683  -connectstring SHAIKPRD2  -local
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_22-42-27PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

RollbackSession rolling back interim patch '13467683' from OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.

Running prerequisite checks...

You selected -local option, hence OPatch will patch the local system only.

Backing up files affected by the patch '13467683' for restore. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
The patch will be removed from active database instances.
Disabling and removing online patch 'bug13467683.pch', on database 'SHAIKPRD2'

RollbackSession removing interim patch '13467683' from inventory

OPatch succeeded.

To rollback from all nodes:

opatch rollback -id 13467683  -connectstring "SHAIKPRD1:system:test123:collabn1,SHAIKPRD2:system:test123:collabn2"




Apply the patch in offline mode:
[oracle@collabn1 13467683]$ srvctl stop database -d SHAIKPRD

[oracle@collabn1 13467683]$ srvctl status database -d SHAIKPRD
Instance SHAIKPRD1 is not running on node collabn1
Instance SHAIKPRD2 is not running on node collabn2

[oracle@collabn1 13467683]$ opatch napply
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_22-58-08PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

Invoking utility "napply"
Checking conflict among patches...
Checking if Oracle Home has components required by patches...
Checking conflicts against Oracle Home...
OPatch continues with these patches:   13467683  

Do you want to proceed? [y|n]
y
User Responded with: Y

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.


This node is part of an Oracle Real Application Cluster.
Remote nodes: 'collabn2'
Local node: 'collabn1'
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0.2/SHAIKPROD')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files affected by the patch 'NApply' for restore. This might take a while...

Applying patch 13467683...

ApplySession applying interim patch '13467683' to OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'
Backing up files affected by the patch '13467683' for rollback. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/lib/libserver11.a" with "lib/libserver11.a/kcbz.o"
ApplySession adding interim patch '13467683' to inventory

Verifying the update...
Inventory check OK: Patch ID 13467683 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 13467683 are present in Oracle Home.
Running make for target ioracle

The local system has been patched and can be restarted.


Patching in rolling mode.


The node 'collabn2' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'collabn2'.
(Oracle Home = '/u01/app/oracle/product/11.2.0.2/SHAIKPROD')

Is the node ready for patching? [y|n]
y
User Responded with: Y
Updating nodes 'collabn2'
  Apply-related files are:
    FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/copy_files.txt"
    DP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/copy_dirs.txt"
    MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/make_cmds.txt"
    RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_22-58-08PM/rac/make_cmds.txt" with actual path.
Running command on remote node 'collabn2':
cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD || echo REMOTE_MAKE_FAILED::>&2

RC file not exist.  There are no commands to be run on the remote nodes.

The node 'collabn2' has been patched.  You can restart Oracle instances on it.

UtilSession: N-Apply done.

OPatch succeeded.



To rollback the patch in offline mode:

[oracle@collabn1 13467683]$ opatch rollback -all_nodes -id 13467683
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_23-00-14PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

RollbackSession rolling back interim patch '13467683' from OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.


This node is part of an Oracle Real Application Cluster.
Remote nodes: 'collabn2'
Local node: 'collabn1'
Please shut down Oracle instances running out of this ORACLE_HOME on all the nodes.
(Oracle Home = '/u01/app/oracle/product/11.2.0.2/SHAIKPROD')


Are all the nodes ready for patching? [y|n]
y
User Responded with: Y
Backing up files affected by the patch '13467683' for restore. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/lib/libserver11.a" with "lib/libserver11.a/kcbz.o"
Running make for target ioracle
RollbackSession removing interim patch '13467683' from inventory

Patching in all-node mode.

Updating nodes 'collabn2'
  Rollback-related files are:
    FR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt"
    DR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt"
    FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt"
    MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt"
    RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt" with actual path.
Removing files on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt" with actual path.
Removing directories on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt" with actual path.
Running command on remote node 'collabn2':
cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD || echo REMOTE_MAKE_FAILED::>&2


All nodes have been patched.  You may start Oracle instances on the local system and nodes 'collabn2'

There were relinks on remote nodes.  Remember to check the binary size and timestamp on the nodes 'collabn2' .
The following make commands were invoked on remote nodes:
'cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
'


OPatch succeeded.

OPatch to install patch - part2

$
0
0
Use OPatch to install patch - Part-2

[oracle@collabn1 13467683]$ opatch napply -silent
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.

UTIL session

Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_23-20-15PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

Invoking utility "napply"
Checking conflict among patches...
Checking if Oracle Home has components required by patches...
Checking conflicts against Oracle Home...
OPatch continues with these patches:   13467683  

Do you want to proceed? [y|n]
Y (auto-answered by -silent)
User Responded with: Y

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.


This node is part of an Oracle Real Application Cluster.
Remote nodes: 'collabn2'
Local node: 'collabn1'
Please shut down Oracle instances running out of this ORACLE_HOME on all the nodes.
(Oracle Home = '/u01/app/oracle/product/11.2.0.2/SHAIKPROD')


Are all the nodes ready for patching? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Backing up files affected by the patch 'NApply' for restore. This might take a while...

Applying patch 13467683...

ApplySession applying interim patch '13467683' to OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'
Backing up files affected by the patch '13467683' for rollback. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/lib/libserver11.a" with "lib/libserver11.a/kcbz.o"
ApplySession adding interim patch '13467683' to inventory

Verifying the update...
Inventory check OK: Patch ID 13467683 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 13467683 are present in Oracle Home.
Running make for target ioracle

The local system has been patched and can be restarted.


Patching in all-node mode.

Updating nodes 'collabn2'
  Apply-related files are:
    FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/copy_files.txt"
    DP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/copy_dirs.txt"
    MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/make_cmds.txt"
    RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/NApply/2015-09-18_23-20-15PM/rac/make_cmds.txt" with actual path.
Running command on remote node 'collabn2':
cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD || echo REMOTE_MAKE_FAILED::>&2

RC file not exist.  There are no commands to be run on the remote nodes.

All nodes have been patched.  You may start Oracle instances on the local system and nodes 'collabn2'

UtilSession: N-Apply done.

OPatch succeeded.


Rollback patch in silent mode:
[oracle@collabn1 13467683]$ opatch rollback -all_nodes -id 13467683 -silent
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Central Inventory : /u01/app/oraInventory
  from           : /etc/oraInst.loc
OPatch version    : 11.1.0.6.6
OUI version       : 11.2.0.1.0
OUI location      : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/oui
Log file location : /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch2015-09-18_23-23-14PM.log

Patch history file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/cfgtoollogs/opatch/opatch_history.txt

RollbackSession rolling back interim patch '13467683' from OH '/u01/app/oracle/product/11.2.0.2/SHAIKPROD'

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.


This node is part of an Oracle Real Application Cluster.
Remote nodes: 'collabn2'
Local node: 'collabn1'
Please shut down Oracle instances running out of this ORACLE_HOME on all the nodes.
(Oracle Home = '/u01/app/oracle/product/11.2.0.2/SHAIKPROD')


Are all the nodes ready for patching? [y|n]
Y (auto-answered by -silent)
User Responded with: Y
Backing up files affected by the patch '13467683' for restore. This might take a while...

Patching component oracle.rdbms, 11.2.0.1.0...
Updating archive file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/lib/libserver11.a" with "lib/libserver11.a/kcbz.o"
Running make for target ioracle
RollbackSession removing interim patch '13467683' from inventory

Patching in all-node mode.

Updating nodes 'collabn2'
  Rollback-related files are:
    FR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt"
    DR = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt"
    FP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt"
    MP = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt"
    RC = "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_files.txt" with actual path.
Removing files on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/remove_dirs.txt" with actual path.
Removing directories on remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/11.2.0.2/SHAIKPROD/.patch_storage/13467683_Feb_5_2012_00_15_49/rac/make_cmds.txt" with actual path.
Running command on remote node 'collabn2':
cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD || echo REMOTE_MAKE_FAILED::>&2


All nodes have been patched.  You may start Oracle instances on the local system and nodes 'collabn2'

There were relinks on remote nodes.  Remember to check the binary size and timestamp on the nodes 'collabn2' .
The following make commands were invoked on remote nodes:
'cd /u01/app/oracle/product/11.2.0.2/SHAIKPROD/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
'


OPatch succeeded.

Use Grid Infrastructure to manage oracle databases and other resources

$
0
0
You can use SRVCTL commands to add, remove, start, stop, modify, enable, and disable a number of entities, such as databases, instances, listeners, SCAN listeners, services, grid naming service (GNS), and Oracle ASM.

Some SRVCTL operations modify the configuration data stored in the Oracle Cluster Registry (OCR). SRVCTL performs other operations, such as starting and stopping instances, by sending requests to the Oracle Clusterware process (CRSD), which then starts or stops the Oracle Clusterware resources.

Summary of Tasks for Which SRVCTL Is Used

SRVCTL is used to manage databases, instances, cluster databases, cluster database instances, Oracle ASM instance and disk groups, services, listeners, or other clusterware resources.
  • Cluster Database Configuration Tasks
    • Add, modify, and delete cluster database configuration information.
    • Add an instance or a service to, and delete an instance or service from the configuration of a cluster database.
    • Move instances and services in a cluster database configuration and modify service configurations.
    • Set and unset the environment for an instance or service in a cluster database configuration.
    • Set and unset the environment for an entire cluster database in a cluster database configuration.
  • General Cluster Database Administration Tasks
    • Start and stop cluster databases
    • Start and stop cluster database instances
    • Start, stop, and relocate cluster database services
    • Obtain statuses of cluster databases, cluster database instances, or cluster database services
  • Node-Level Tasks
    • Adding and deleting node level applications, server pools, and VIPs
    • Setting and unsetting the environment for node-level applications
    • Administering disk groups
    • Administering server pools
    • Administering node applications
    • Administering Oracle ASM instances
    • Starting and stopping a group of programs that includes virtual IP addresses (VIPs), listeners, and Oracle Notification Services


When you set an environment variable via srvctl, it only affects the startup with srvctl, it does not affect when you start it using sqlplus

[oracle@collabn1 ~]$ srvctl
Usage: srvctl <command> <object> [<options>]
    commands: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
    objects: database|instance|service|nodeapps|vip|asm|diskgroup|listener|srvpool|server|scan|scan_listener|oc4j|home|filesystem|gns
For detailed help on each command and object and its options use:
 srvctl <command> -h or
 srvctl <command> <object> -h

[oracle@collabn1 ~]$ srvctl getenv -h

The SRVCTL getenv command Gets and displays values for the environment from the configuration file. It allows users to administer environment configuration for the objects.

Usage: srvctl getenv database -d <db_unique_name> [-t "<name_list>"]
Usage: srvctl getenv nodeapps [-a] [-g] [-s] [-e] [-t "<name_list>"]
Usage: srvctl getenv vip -i <vip_name> [-t "<name_list>"]
Usage: srvctl getenv listener [-l <lsnr_name>] [-t <name>[, ...]]
Usage: srvctl getenv asm [-t <name>[, ...]]


[oracle@collabn1 ~]$ srvctl setenv database -d  SHAIKDB -T "TNS_ADMIN=/u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin"


[oracle@collabn1 ~]$ srvctl getenv database -d SHAIKDB
SHAIKDB:
TNS_ADMIN=/u01/app/oracle/product/11.2.0.2/SHAIKPROD/network/admin


[oracle@collabn1 ~]$ srvctl stop database -d SHAIKDB

[oracle@collabn1 ~]$ srvctl start instance -d SHAIKPRD -i SHAIKPRD1

[oracle@collabn1 ~]$ srvctl status database -d SHAIKPRD
Instance SHAIKPRD1 is running on node collabn1
Instance SHAIKPRD2 is not running on node collabn2   


[oracle@collabn1 ~]$ srvctl remove database -d SHAIKDB
Remove the database SHAIKDB? (y/[n]) y
[oracle@collabn1 ~]$ srvctl add  database -d SHAIKDB -o /u01/app/oracle/product/11.2.0.2/SHAIKPROD
[oracle@collabn1 ~]$ srvctl config  database -d SHAIKDB
Database unique name: SHAIKDB
Database name:
Oracle home: /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Oracle user: oracle
Spfile:
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: SHAIKDB
Database instances:
Disk Groups:
Services:
Database is administrator managed
[oracle@collabn1 ~]$ srvctl getenv database -d SHAIKDB
SHAIKDB:


Listener Maintenance:

[oracle@collabn1 ~]$ srvctl start listener -l shaikdb

[oracle@collabn1 ~]$ srvctl status listener -l shaikdb
Listener SHAIKDB is enabled
Listener SHAIKDB is running on node(s): collabn1

[oracle@collabn1 ~]$ srvctl stop listener -l shaikdb

[oracle@collabn1 ~]$ srvctl remove listener -l shaikdb

[oracle@collabn1 ~]$ tnsping shaikdb

TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 19-SEP-2015 22:05:30

Copyright (c) 1997, 2009, Oracle.  All rights reserved.

Used parameter files:


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = collabn1.shaiksameer)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = SHAIKDB.shaiksameer)))
OK (10 msec)


SCAN_LISTENER:


[oracle@collabn1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node collabn1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node collabn1
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node collabn1

[oracle@collabn1 ~]$ srvctl stop scan_listener

[oracle@collabn1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is not running
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is not running
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is not running

[oracle@collabn1 ~]$ srvctl start scan_listener

[oracle@collabn1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node collabn1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node collabn1
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node collabn1

[oracle@collabn1 ~]$ srvctl relocate scan_listener -i 2 -n collabn2

[oracle@collabn1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node collabn2
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node collabn2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node collabn1

[oracle@collabn1 ~]$ srvctl relocate scan_listener -i 1 -n collabn1

[oracle@collabn1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node collabn1
SCAN Listener LISTENER_SCAN2 is enabled
SCAN listener LISTENER_SCAN2 is running on node collabn2
SCAN Listener LISTENER_SCAN3 is enabled
SCAN listener LISTENER_SCAN3 is running on node collabn1


[oracle@collabn1 ~]$ srvctl add service -h

Adds a service configuration to the Oracle Clusterware.

Usage: srvctl add service -d <db_unique_name> -s <service_name> {-r "<preferred_list>" [-a "<available_list>"] [-P {BASIC | NONE | PRECONNECT}] | -g <server_pool> [-c {UNIFORM | SINGLETON}] } [-k   <net_num>] [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z <failover_retries>] [-w <failover_delay>]


SERVICE Maintenance:

[oracle@collabn1 ~]$ srvctl add service -d SHAIKPRD -s TEST1 -r SHAIKPRD1 -a SHAIKPRD2

[oracle@collabn1 ~]$ srvctl status service -d SHAIKPRD -s test1
Service TEST1 is not running.

[oracle@collabn1 ~]$ srvctl start service -d SHAIKPRD -s test1

[oracle@collabn1 ~]$ srvctl status service -d SHAIKPRD -s test1
Service TEST1 is running on instance(s) SHAIKPRD1

[oracle@collabn1 ~]$ srvctl config service -d shaikprd -s test1
Service name: TEST1
Service is enabled
Server pool: SHAIKPRD_TEST1
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Preferred instances: SHAIKPRD1
Available instances: SHAIKPRD2

[oracle@collabn1 ~]$ srvctl status service -d shaikprd
Service TEST1 is running on instance(s) SHAIKPRD1

[oracle@collabn1 ~]$ srvctl status service -d shaikprd
Service TEST1 is running on instance(s) SHAIKPRD1
[oracle@collabn1 ~]$


[oracle@collabn1 ~]$ srvctl stop service -d shaikprd -s test1

[oracle@collabn1 ~]$ srvctl remove service -d shaikprd -s test1

[oracle@collabn1 ~]$ srvctl add  service -d shaikprd -s test1 -r SHAIKPRD1 -a SHAIKPRD2 -P preconnect

[oracle@collabn1 ~]$ srvctl start service -d shaikprd -s test1

[oracle@collabn1 ~]$ srvctl status service -d shaikprd -s test1
Service test1 is running on instance(s) SHAIKPRD1

[oracle@collabn1 ~]$ srvctl stop instance  -d SHAIKPRD -i SHAIKPRD1 -f

[oracle@collabn1 ~]$ srvctl status database -d SHAIKPRD
Instance SHAIKPRD1 is not running on node collabn1
Instance SHAIKPRD2 is running on node collabn2

[oracle@collabn1 ~]$ srvctl status service -d shaikprd -s test1
Service test1 is running on instance(s) SHAIKPRD2


Docs:

Use Enterprise Manager Configuration Assistant(EMCA) utility

$
0
0
Use Enterprise Manager Configuration Assistant(EMCA) utility


Using Database Control, you can perform administrative tasks such as creating schema objects (tables, views, indexes, and so on), managing user security, managing database memory and storage, backing up and recovering your database, and importing and exporting data. You can also view performance and status information about your database.

Files that are common and shared among all instances of the database are stored in the following directory:
$ORACLE_HOME/sysman


Files that are unique to each instance of the database are stored in the following directory:

  • $ORACLE_HOME/hostname_dbuniquename/ (for a single-instance database)
  • $ORACLE_HOME/nodename_dbuniquename/ (for an Oracle Real Applications Cluster (Oracle RAC) database)

Ex:-

[oracle@collabn1 SHAIKPROD]$ ls -ld collabn1*

drwxr----- 3 oracle oinstall 4096 Sep  5 00:56 collabn1_orcl
drwxr----- 3 oracle oinstall 4096 Sep 20 11:34 collabn1_SHAIKDB
drwxr----- 3 oracle oinstall 4096 Aug  3 01:26 collabn1_SHAIKPRD
drwxr----- 3 oracle oinstall 4096 Aug  1 18:21 collabn1.shaiksameer_SHAIKPRD1


Directory Structure in the Management Service Home for Release 11g or Later

Screen Shot 2015-09-20 at 11.36.19 AM.png


Drop db control repository:


[oracle@collabn1 ~]$ emca -deconfig dbcontrol db -repos drop

STARTED EMCA at Sep 20, 2015 11:28:01 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: SHAIKDB
Listener port number: 1522
Password for SYS user:  
Password for SYSMAN user:  

Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_28_01.log.
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.EMDBPreConfig performDeconfiguration
WARNING: EM is not configured for this database. No EM-specific actions can be performed.
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.ParamsManager checkListenerStatusForDBControl
WARNING: Error initializing SQL connection. SQL operations cannot be performed
Sep 20, 2015 11:29:18 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Sep 20, 2015 11:30:05 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 11:30:05 AM



To create db control repository:

[oracle@collabn1 ~]$ emca -config dbcontrol db -repos create

STARTED EMCA at Sep 20, 2015 11:30:49 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: SHAIKDB
Listener port number: 1522
Listener ORACLE_HOME [ /u01/app/oracle/product/11.2.0.2/SHAIKPROD ]:
Password for SYS user:  
Password for DBSNMP user:  
Password for SYSMAN user:  
Email address for notifications (optional):
Outgoing Mail (SMTP) server for notifications (optional):
-----------------------------------------------------------------

You have specified the following settings

Database ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.2/SHAIKPROD

Local hostname ................ collabn1.shaiksameer
Listener ORACLE_HOME ................ /u01/app/oracle/product/11.2.0.2/SHAIKPROD
Listener port number ................ 1522
Database SID ................ SHAIKDB
Email address for notifications ...............
Outgoing Mail (SMTP) server for notifications ...............

-----------------------------------------------------------------
Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 11:31:07 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_30_48.log.
Sep 20, 2015 11:31:08 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 20, 2015 11:34:04 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 20, 2015 11:34:06 AM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 20, 2015 11:34:32 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 20, 2015 11:34:33 AM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Sep 20, 2015 11:34:33 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Sep 20, 2015 11:34:47 AM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Sep 20, 2015 11:34:47 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 20, 2015 11:35:08 AM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Sep 20, 2015 11:35:08 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 11:35:39 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 20, 2015 11:35:39 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:5501/em <<<<<<<<<<<
Sep 20, 2015 11:35:41 AM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/config/emkey.ora.   Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 11:35:41 AM



Using response files to create/drop the db control repository:


Create the responsefile:

[oracle@collabn1 sshaik]$ vi emca_drop.rsp
SID=SHAIKDB
SYS_PWD=test123
SYSMAN_PWD=test123
DBSNMP_PWD=test123
PORT=1522

[oracle@collabn1 sshaik]$ emca -deconfig dbcontrol db -repos drop -respfile ~/sshaik/emca_drop.rsp

STARTED EMCA at Sep 20, 2015 11:49:56 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:

Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 11:50:00 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_49_56.log.
Sep 20, 2015 11:50:00 AM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Sep 20, 2015 11:50:20 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Dropping the EM repository (this may take a while) ...
Sep 20, 2015 11:51:22 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully dropped
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 11:51:23 AM


Create the em repository using response file:

Response file:

[oracle@collabn1 SHAIKPROD]$ cat ~/sshaik/emca_create_rsp
SID=SHAIKDB
SYS_PWD=test123
SYSMAN_PWD=test123
DBSNMP_PWD=test123
PORT=1522
LISTENER_OH=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD

[oracle@collabn1 sshaik]$ emca -config dbcontrol db -repos create -silent -respfile ~/sshaik/emca_drop.rsp

STARTED EMCA at Sep 20, 2015 11:57:08 AM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Sep 20, 2015 11:57:09 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_11_57_08.log.
Sep 20, 2015 11:57:10 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Sep 20, 2015 12:00:00 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Sep 20, 2015 12:00:03 PM oracle.sysman.emcp.EMReposConfig uploadConfigDataToRepository
INFO: Uploading configuration data to EM repository (this may take a while) ...
Sep 20, 2015 12:00:31 PM oracle.sysman.emcp.EMReposConfig invoke
INFO: Uploaded configuration data successfully
Sep 20, 2015 12:00:32 PM oracle.sysman.emcp.util.DBControlUtil configureSoftwareLib
INFO: Software library configured successfully.
Sep 20, 2015 12:00:32 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Deploying Provisioning archives ...
Sep 20, 2015 12:00:49 PM oracle.sysman.emcp.EMDBPostConfig configureSoftwareLibrary
INFO: Provisioning archives deployed successfully.
Sep 20, 2015 12:00:49 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Securing Database Control (this may take a while) ...
Sep 20, 2015 12:01:06 PM oracle.sysman.emcp.util.DBControlUtil secureDBConsole
INFO: Database Control secured successfully.
Sep 20, 2015 12:01:06 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 12:01:39 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Sep 20, 2015 12:01:39 PM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:5501/em<<<<<<<<<<<
Sep 20, 2015 12:01:40 PM oracle.sysman.emcp.EMDBPostConfig invoke
WARNING:
************************  WARNING  ************************

Management Repository has been placed in secure mode wherein Enterprise Manager data will be encrypted.  The encryption key has been placed in the file: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/config/emkey.ora.   Please ensure this file is backed up as the encrypted data will become unusable if this file is lost.

***********************************************************
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 12:01:40 PM



Reconfigure the ports:

[oracle@collabn1 sshaik]$ emca -reconfig ports

STARTED EMCA at Sep 20, 2015 12:16:30 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Database SID: SHAIKDB
Password for SYS user:  

Do you wish to continue? [yes(Y)/no(N)]: y
Sep 20, 2015 12:16:46 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_12_16_30.log.
Sep 20, 2015 12:16:46 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Sep 20, 2015 12:17:06 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 12:17:33 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: Database Control started successfully
Sep 20, 2015 12:17:33 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:5502/em<<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 12:17:33 PM


EMCA reads the emca.properties file and assigns the ports automatically:

cat /u01/app/oracle/product/11.2.0.2/SHAIKPROD/sysman/config/emca.properties

# EMCA Properties File

#Default Port Ranges

# Agent Port Ranges
AGENT_PORT_MIN=1830
AGENT_PORT_MAX=1849

# DB Control Agent Port assigned by IANA
AGENT_PORT_DEFAULT=3938

DBCONTROL_HTTP_PORT_MIN=5500
DBCONTROL_HTTP_PORT_MAX=5519

# DB Control Http Port assigned by IANA
DBCONTROL_HTTP_PORT_DEFAULT=1158

# RMI Port Ranges
RMI_PORT_MIN=5520
RMI_PORT_MAX=5539

# DB Control RMI Port assigned by IANA
RMI_PORT_DEFAULT=-1

# JMS Port Ranges
JMS_PORT_MIN=5540
JMS_PORT_MAX=5559


If you would like to provide the ports manually then create a response file and assign it:

[oracle@collabn1 sshaik]$ vi emca_ports.rsp
SID=SHAIKDB
SYS_PWD=test123
SYSMAN_PWD=test123
DBSNMP_PWD=test123
PORT=1522
LISTENER_OH=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
ORACLE_HOME=/u01/app/oracle/product/11.2.0.2/SHAIKPROD
#Ports for db agent
JMS_PORT_MIN=3331
AGENT_PORT=3334
DBCONTROL_HTTP_PORT=3333
RMI_PORT=3335


[oracle@collabn1 sshaik]$ emca -reconfig ports -silent -respfile ~/sshaik/emca_ports.rsp

STARTED EMCA at Sep 20, 2015 12:26:08 PM
EM Configuration Assistant, Version 11.2.0.0.2 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.


Sep 20, 2015 12:26:09 PM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /u01/app/oracle/cfgtoollogs/emca/SHAIKDB/emca_2015_09_20_12_26_08.log.
Sep 20, 2015 12:26:09 PM oracle.sysman.emcp.util.DBControlUtil stopOMS
INFO: Stopping Database Control (this may take a while) ...
Sep 20, 2015 12:26:28 PM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Sep 20, 2015 12:26:55 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: Database Control started successfully
Sep 20, 2015 12:26:55 PM oracle.sysman.emcp.EMDBPostConfig performReconfiguration
INFO: >>>>>>>>>>> The Database Control URL is https://collabn1.shaiksameer:3333/em<<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Sep 20, 2015 12:26:55 PM


[oracle@collabn1 sshaik]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://collabn1.shaiksameer:3333/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/log


Lets convert dbconsole to use non-ssl (http) or unsecure port:

[oracle@collabn1 sshaik]$ emctl unsecure dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
https://collabn1.shaiksameer:3333/em/console/aboutApplication
Configuring DBConsole for HTTP...   Done.
DBCONSOLE successfully stopped...   Done.
Agent is already stopped...   Done.
Unsecuring dbconsole...   Started.
DBConsole is now unsecured...  Done.
Unsecuring dbconsole...  Sucessful.
DBCONSOLE successfully restarted...   Done.



[oracle@collabn1 sshaik]$ emctl status dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
http://collabn1.shaiksameer:3333/em/console/aboutApplication
Oracle Enterprise Manager 11g is running.
------------------------------------------------------------------
Logs are generated in directory /u01/app/oracle/product/11.2.0.2/SHAIKPROD/collabn1_SHAIKDB/sysman/log

Access the URL and Verify you are able to login:



Documentation:
Database Administration→ 10. Managing Oracle Enterprise Manager Database Control

oracle.ops.mgmt.has.ClusterUtilException: PRKH-1010 : Unable to communicate with CRS services.

$
0
0

While creating a standalone database on a Clustered Oracle Home:

[oracle@collabn1 has]$ dbca -createdatabase -templatename General_Purpose.dbc -datafiledestination /u01/app/oracle/shaikdb -nationalcharacterset al16utf16 -characterset al32utf8 -silent -sid SHAIKDB -gdbname SHAIKDB.shaiksameer


oracle.ops.mgmt.has.ClusterUtilException: PRKH-1010 : Unable to communicate with CRS services.
 [Communications Error(Native: prsr_initCLSS:[3])]
   at oracle.ops.mgmt.has.ClusterUtil.<init>(ClusterUtil.java:62)
   at oracle.sysman.assistants.util.hasi.HAUtils.<init>(HAUtils.java:201)
   at oracle.sysman.assistants.util.hasi.HAUtils.getInstance(HAUtils.java:228)
   at oracle.sysman.assistants.util.NetworkUtils.getOneLocalListenerProtocolAddress(NetworkUtils.java:2982)
   at oracle.sysman.assistants.util.NetworkUtils.getOneLocalListenerProtocolAddress(NetworkUtils.java:2961)
   at oracle.sysman.assistants.util.NetworkUtils.getLocalListenerAddressForPort(NetworkUtils.java:1210)
   at oracle.sysman.assistants.util.NetworkUtils.getLocalListenerAddress(NetworkUtils.java:1193)
   at oracle.sysman.assistants.util.NetworkUtils.getLocalListenerAddresses(NetworkUtils.java:1247)
   at oracle.sysman.assistants.util.NetworkUtils.needLocalListener(NetworkUtils.java:1169)
   at oracle.sysman.assistants.util.step.StepContext.setListenersToUpdate(StepContext.java:856)
   at oracle.sysman.assistants.util.step.StepContext.<init>(StepContext.java:319)
   at oracle.sysman.assistants.dbca.backend.Host.<init>(Host.java:778)
   at oracle.sysman.assistants.dbca.backend.SilentHost.<init>(SilentHost.java:144)
   at oracle.sysman.assistants.dbca.Dbca.getHost(Dbca.java:154)
   at oracle.sysman.assistants.dbca.Dbca.execute(Dbca.java:112)
   at oracle.sysman.assistants.dbca.Dbca.main(Dbca.java:184)
PRKH-1007 : Exception Caused by:
oracle.ops.mgmt.has.HASContextException: Communications Error(Native: prsr_initCLSS:[3])
   at oracle.ops.mgmt.has.HASContextNative.allocHASContext(Native Method)
   at oracle.ops.mgmt.has.HASContext.<init>(HASContext.java:109)
   at oracle.ops.mgmt.has.HASContext.getInstance(HASContext.java:237)
   at oracle.ops.mgmt.has.ClusterUtil.<init>(ClusterUtil.java:60)
   at oracle.sysman.assistants.util.hasi.HAUtils.<init>(HAUtils.java:201)
   at oracle.sysman.assistants.util.hasi.HAUtils.getInstance(HAUtils.java:228)
   at oracle.sysman.assistants.util.NetworkUtils.getOneLocalListenerProtocolAddress(NetworkUtils.java:2982)
   at oracle.sysman.assistants.util.NetworkUtils.getOneLocalListenerProtocolAddress(NetworkUtils.java:2961)
   at oracle.sysman.assistants.util.NetworkUtils.getLocalListenerAddressForPort(NetworkUtils.java:1210)
   at oracle.sysman.assistants.util.NetworkUtils.getLocalListenerAddress(NetworkUtils.java:1193)
   at oracle.sysman.assistants.util.NetworkUtils.getLocalListenerAddresses(NetworkUtils.java:1247)
   at oracle.sysman.assistants.util.NetworkUtils.needLocalListener(NetworkUtils.java:1169)
   at oracle.sysman.assistants.util.step.StepContext.setListenersToUpdate(StepContext.java:856)
   at oracle.sysman.assistants.util.step.StepContext.<init>(StepContext.java:319)
   at oracle.sysman.assistants.dbca.backend.Host.<init>(Host.java:778)
   at oracle.sysman.assistants.dbca.backend.SilentHost.<init>(SilentHost.java:144)
   at oracle.sysman.assistants.dbca.Dbca.getHost(Dbca.java:154)
   at oracle.sysman.assistants.dbca.Dbca.execute(Dbca.java:112)
   at oracle.sysman.assistants.dbca.Dbca.main(Dbca.java:184)



Fix:-

Modify as root user → local_only variable in /etc/oracle/ocr.loc or /var/opt/oracle/ocr.loc set to FALSE

[root@collabn1 ~]# vi /etc/oracle/ocr.loc

Before:
[oracle@collabn1 has]$ cat /etc/oracle/ocr.loc
#Device/file +DATA getting replaced by device +DATA/collabn-cluster/OCRFILE/registry.255.886591195
ocrconfig_loc=+DATA/collabn-cluster/OCRFILE/registry.255.886591195
local_only=false


After:
[oracle@collabn1 has]$ cat /etc/oracle/ocr.loc
#Device/file +DATA getting replaced by device +DATA/collabn-cluster/OCRFILE/registry.255.886591195
ocrconfig_loc=+DATA/collabn-cluster/OCRFILE/registry.255.886591195
local_only=true

ORA-29702: error occurred in Cluster Group Service operation

$
0
0
RDBMS install is not running on RAC but still it is assuming it to be RAC instance.


SHAIKDB>startup
ORA-29702: error occurred in Cluster Group Service operation

Try the below on the Oracle_HOME:

$ cd $ORACLE_HOME/rdbms/lib

$ make -f ins_rdbms.mk rac_off

$ make -f ins_rdbms.mk ioracle

Install demo schemas in 11gR2:

$
0
0

Install demo schemas in 11gR2:


SHAIKDB>@?/demo/schema/mkplug

specify password for SYS as parameter 1:

specify password for HR as parameter 2:

specify password for OE as parameter 3:
Enter value for 3: oe

specify password for PM as parameter 4:
Enter value for 4: pm

specify password for IX as parameter 5:
Enter value for 5: ix

specify password for  SH as parameter 6:
Enter value for 6: sh

specify password for  BI as parameter 7:
Enter value for 7: bi

specify INPUT metadata import file as parameter 8:
Enter value for 8: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/assistants/dbca/templates/example.dmp

specify INPUT database backup file for tablespace EXAMPLE as parameter 9:
Enter value for 9: /u01/app/oracle/product/11.2.0.2/SHAIKPROD/assistants/dbca/templates/example01.dfb

specify OUTPUT database file for tablespace EXAMPLE as parameter 10:
Enter value for 10: /u01/app/oracle/shaikdb/example02.dbf

specify OUTPUT log directory as parameter 11:
Enter value for 11: /u01/app/oracle/shaikdb/demo.log

Oracle 11gR2 Create Table

$
0
0
Oracle create table syntax:


CREATE [ GLOBALTEMPORARY ] TABLE
[ schema.]table OF
[ schema.]object_type
[ ( relational_properties ) ]
[ ONCOMMIT { DELETE | PRESERVE } ROWS ]
[ OID_clause ]
[ OID_index_clause ]
[ physical_properties ]
[ table_properties ] ;

<relational_properties> ::=
{ column_definition
| { out_of_line_constraint
| out_of_line_ref_constraint
| supplemental_logging_props
}
}
[, { column_definition
| { out_of_line_constraint
| out_of_line_ref_constraint
| supplemental_logging_props
}
]...

<column_definition> ::=
column data_type [ SORT ]
[ DEFAULT expr ]
[ ENCRYPT encryption_spec ]
[ ( inline_constraint [ inline_constraint ] ... )
| inline_ref_constraint
]

<data_type> ::=
{ Oracle_built_in_datatypes
| ANSI_supported_datatypes
| user_defined_types
| Oracle_supplied_types
}

<Oracle_built_in_datatypes> ::=
{ character_datatypes
| number_datatypes
| long_and_raw_datatypes
| datetime_datatypes
| large_object_datatypes
| rowid_datatypes
}

<large_object_datatypes> ::=
{ BLOB | CLOB | NCLOB| BFILE }

<table_properties> ::=
[ column_properties ]
[ table_partitioning_clauses ]
[ CACHE | NOCACHE ]
[ parallel_clause ]
[ ROWDEPENDENCIES | NOROWDEPENDENCIES ]
[ enable_disable_clause ]
[ enable_disable_clause ]...
[ row_movement_clause ]
[ AS subquery ]

<column_properties> ::=
{ object_type_col_properties
| nested_table_col_properties
| { varray_col_properties | LOB_storage_clause }
[ (LOB_partition_storage
[, LOB_partition_storage ]...
)
]
| XMLType_column_properties
}
[ { object_type_col_properties
| nested_table_col_properties
| { varray_col_properties | LOB_storage_clause }
[ ( LOB_partition_storage
[, LOB_partition_storage ]...
)
]
| XMLType_column_properties
}
]...

<LOB_partition_storage> ::=
PARTITION partition
{ LOB_storage_clause | varray_col_properties }
[ LOB_storage_clause | varray_col_properties ]...
[ ( SUBPARTITION subpartition
{ LOB_storage_clause | varray_col_properties }
[ LOB_storage_clause
| varray_col_properties
]...
)
]

<LOB_storage_clause> ::=
LOB
{ (LOB_item [, LOB_item ]...)
STOREAS [ SECUREFILE | BASICFILE ] (LOB_storage_parameters)
| (LOB_item)
STOREAS [ SECUREFILE | BASICFILE ]
{ LOB_segname (LOB_storage_parameters)
| LOB_segname
| (LOB_storage_parameters)
}
}

<LOB_storage_parameters> ::=
{ TABLESPACE tablespace
| { LOB_parameters [ storage_clause ]
}
| storage_clause
}
[ TABLESPACE tablespace
| { LOB_parameters [ storage_clause ]
}
]...

<LOB_parameters> ::=
[ { ENABLE | DISABLE } STORAGEINROW
| CHUNK integer
| PCTVERSION integer
| RETENTION [ { MAX | MIN integer | AUTO | NONE } ]
| FREEPOOLS integer
| LOB_deduplicate_clause
| LOB_compression_clause
| LOB_encryption_clause
| { CACHE | { { NOCACHE | CACHEREADS } [ logging_clause ] } }
]

<logging_clause> ::=
{ LOGGING | NOLOGGING | FILESYSTEM_LIKE_LOGGING }

<storage_clause> ::=
STORAGE
({ INITIAL integer [ K | M ]
| NEXT integer [ K | M ]
| MINEXTENTS integer
| MAXEXTENTS { integer | UNLIMITED }
| PCTINCREASE integer
| FREELISTS integer
| FREELISTGROUPS integer
| OPTIMAL [ integer [ K | M ]
| NULL
]
| BUFFER_POOL { KEEP | RECYCLE | DEFAULT }
}
[ INITIAL integer [ K | M ]
| NEXT integer [ K | M ]
| MINEXTENTS integer
| MAXEXTENTS { integer | UNLIMITED }
| MAXSIZE { { integer { K | M | G | T | P } } | UNLIMITED }
| PCTINCREASE integer
| FREELISTS integer
| FREELISTGROUPS integer
| OPTIMAL [ integer [ K | M ]
| NULL
]
| BUFFER_POOL { KEEP | RECYCLE | DEFAULT }
]...
)

<LOB_deduplicate_clause> ::=
{ DEDUPLICATE
| KEEP_DUPLICATES
}

<LOB_compression_clause> ::=
{ COMPRESS [ HIGH | MEDIUM | LOW ]
| NOCOMPRESS }

<LOB_encryption_clause> ::=
{ ENCRYPT [ USING'encrypt_algorithm' ]
[ IDENTIFIEDBY password ]
| DECRYPT
}

<XMLType_column_properties> ::=
XMLTYPE [ COLUMN ] column
[ XMLType_storage ]
[ XMLSchema_spec ]

<XMLType_storage> ::=
STOREAS
{ OBJECTRELATIONAL
| [ SECUREFILE | BASICFILE ] { CLOB | BINARYXML }
[ { LOB_segname [ (LOB_parameters) ]
| LOB_parameters
}
]

<varray_col_properties> ::=
VARRAY varray_item
{ [ substitutable_column_clause ]
STOREAS [ SECUREFILE | BASICFILE ] LOB
{ [ LOB_segname ] (LOB_parameters)
| LOB_segname
}
| substitutable_column_clause
}
 
 
ALTERTABLE [ schema.]table
[ alter_table_properties
| column_clauses
| constraint_clauses
| alter_table_partitioning
| alter_external_table_clauses
| move_table_clause
]
[ enable_disable_clause
| { ENABLE | DISABLE }
{ TABLELOCK | ALLTRIGGERS }
[ enable_disable_clause
| { ENABLE | DISABLE }
{ TABLELOCK | ALLTRIGGERS }
]...
] ;


<column_clauses> ::=
{ { add_column_clause
| modify_column_clause
| drop_column_clause
}
[ add_column_clause
| modify_column_clause
| drop_column_clause
]...
| rename_column_clause
| modify_collection_retrieval
[ modify_collection_retrieval ]...
| modify_LOB_storage_clause
[ modify_LOB_storage_clause ] ...
| alter_varray_col_properties
[ alter_varray_col_properties ]
}

<modify_LOB_storage_clause> ::=
MODIFYLOB (LOB_item) ( modify_LOB_parameters )

<modify_LOB_parameters> ::=
{ storage_clause
| PCTVERSION integer
| FREEPOOLS integer
| REBUILD FREEPOOLS
| LOB_retention_clause
| LOB_deduplicate_clause
| LOB_compression_clause
| { ENCRYPT encryption_spec | DECRYPT }
| { CACHE
| { NOCACHE | CACHEREADS } [ logging_clause ]
}
| allocate_extent_clause
| shrink_clause
| deallocate_unused_clause
} ... 
 
 

Implement securefile LOB

$
0
0
Implement securefile LOB


SHAIKDB>show parameter securefile

NAME                    TYPE     VALUE
------------------------------------ ----------- ------------------------------
db_securefile                string     PERMITTED

Allowable Values: { ALWAYS | PERMITTED | NEVER | IGNORE }

Description: This parameter enables the database administrator to either allow SECUREFILE LOBs to be created (PERMITTED), disallow SECUREFILE LOBs from being created going forward (NEVER), attempt to create SECUREFILE LOBs but fall back to BASICFILE LOBs (ALWAYS), or disallow SECUREFILE LOBs and ignore any errors that would otherwise be caused by forcing BASICFILE LOBs with SECUREFILE options (IGNORE).

If NEVER is specified, any LOBs that are specified as SECUREFILE LOBs are created as BASICFILE LOBs. All SECUREFILE specific storage options and features (for example, compress, encrypt, deduplicate) will throw an exception. The BASICFILE LOB defaults are used for storage options not specified.

ALWAYS attempts to create all LOBs as SECUREFILE LOBs but creates any LOBs not in ASSM tablespaces as BASICFILE LOBs, unless SECUREFILE is explicitly specified. Any BASICFILE LOB storage options specified will be ignored, and the SECUREFILE defaults are used for all storage options not specified.

IfIGNORE is specified, the SECUREFILE keyword and all SECUREFILE options are ignored.
Dynamic: The parameter is dynamic and the scope is ALTER SYSTEM.



SecureFiles Monitoring

DATA DICTONARY          VIEW USAGE

DBA_SEGMENTS            Shows all segments in the database, and includes a new column, SEGMENT_SUBTYPE, that describes the LOB segment type.
DBA_LOBS                Lists all LOBs in the database, and now includes metadata about compression,encryption and deduplication.
DBA_LOB_PARTITIONS      Describes all LOB partitions in the database, and now includes metadata about     compression,encryption and deduplication.
DBA_PART_LOBS           Shows table-level metadata for all partitioned LOBs in the database.


A SecureFile can only be created in an Automatic Segment Space Management (ASSM) tablespace. The following parameter descriptions apply to the LOB storage paradigm using parameter SECUREFILE.

SECUREFILE

To use the SecureFile storage paradigm and functionality, explicitly specify the storage parameter SECUREFILE. A SecureFile can only be created in an Automatic Segment Space Management (ASSM) tablespace.
For BASICFILE LOBs, specifying any of the SECUREFILE options results in an error.

CHUNK

For SECUREFILE LOBs CHUNK is an advisory size and is provided for backward compatibility purposes.

RETENTION

Under 11g compatibility for SecureFiles, this parameter name specifies the retention policy to be used. The value of MAX specifies keeping old versions of LOB data blocks until the space used by segment has reached the size specified in the MAXSIZE parameter. If MAXSIZE is not specified, MAX behaves like AUTO.
A value of MIN means to use a retention time of the specified seconds. A value of NONE means that there is no retention period and space can be reused in any way deemed necessary. A value of AUTO tells the system to manage the space as efficiently as possible weighing both time and space needs.

FILESYSTEM_LIKE_LOGGING means that SecureFiles only log the metadata. This option is invalid for BasicFiles. This setting is similar to the metadata journaling of file systems, which reduces mean time to recovery from failures. The LOGGING setting for SecureFile LOBs is similar to the data journaling of file systems. Both the LOGGING and FILESYSTEM_LIKE_LOGGING settings provide a complete transactional file system by way of SecureFiles.




DEDUPLICATE

The option DEDUPLICATE enables you to specify that LOB data which is identical in two or more rows in a LOB column should all share the same data blocks. The database combines SecureFiles with identical content into a single copy, reducing storage and simplifying storage management.

KEEP_DUPLICATES

The opposite of DEDUPLICATE is KEEP_DUPLICATES.


DBMS_LOB.SETOPTIONS can be used to enable or disable deduplication on individual LOBs.

CACHE and NOLOGGING are not supported together. CACHE and FILESYSTEM_LIKE_LOGGING are not supported together.

<large_object_datatypes> ::=
{ BLOB | CLOB | NCLOB| BFILE }



Demo:
Create a table with SECUREFILE and LOB-level deduplication:

SHAIKDB>create tablespace lobs datafile '/u01/app/oracle/shaikdb/lob01.dbf' size 1g autoextend on next 8m maxsize 10g;   

Tablespace created.

SHAIKDB>create user lob identified by lob default tablespace lobs;

User created.

SHAIKDB>grant create session,dba to lob;

Grant succeeded.


SHAIKDB>create table dedup (id number,desc1 blob)
   lob(desc1) store as securefile (deduplicate nocache) tablespace lobs;

Table created.


SHAIKDB>select table_name,tablespace_name,index_name,deduplication,securefile from user_lobs;

TABLE_NAME   TABLESPACE       INDEX_NAME            DEDUPLICATION   SEC
----------         ----------                ------------------------------                   --------------- ---
DEDUP       LOBS       SYS_IL0000074709C00002$$         LOB         YES



Create a table with a SECUREFILE LOB column and LOB deduplication enabled on only one partition. Only LOBs that belong to partition p1 are deduplicated.

SHAIKDB>create table dedup_part (id number,desc1 clob)
 2  lob(desc1) store as securefile
 3  partition by list(id) (
 4  partition p1 values ('1','3','5') lob(desc1) store as securefile (deduplicate),
 5  partition p2 values ('2','4','6'));

Table created.

Create a table with a SECUREFILE LOB column and disable deduplication. LOBs will be created with deduplication disabled.

SHAIKDB>create table nodedup (id number,desc1 nclob)
 2  lob(desc1) store as securefile tablespace lobs;

Table created.



Create a table with a SecureFile column and SecureFile deduplication enabled on the column except for one partition. All LOBs except those that belong to p2 will be deduplicated:

SHAIKDB>create table dedup_sub_part (id number,region varchar2(10),desc1 clob)
 2  lob(desc1) store as securefile (deduplicate cache)
 3  partition by range (region)  subpartition by hash(id) subpartitions 4 (
 4    partition p1 values less than (10) lob(desc1) store as part1
 5  ( subpartition p1_sub lob(desc1) store as subp1,
 6  subpartition p2_sub lob(desc1) store as subp2));

Table created.


SECUREFILE TABLE with Compression

  • SecureFile compression does not entail table or index compression and vice-versa.
  • A server-wide default SecureFile compression algorithm is used.
  • LOW,MEDIUM, and HIGH options provide varying degrees of compression. The higher the compression, the higher the latency incurred. The HIGH setting incurs more work, but will compress the data better. The default is MEDIUM. LOW option uses LZO block-based lossless compression algorithm. Decompression is simple and very fast.


Create a table with a SECUREFILE LOB column and LOB compression enabled on only one partition. Only LOBs that belong to partition p1 are compressed.

SHAIKDB>CREATE TABLE COMP (ID NUMBER,DESC1 CLOB)
 2  LOB(DESC1) STORE AS SECUREFILE (COMPRESS HIGH DEDUPLICATE CACHE);

Table created.


Parameters for ALTER TABLE With SECUREFILE LOBs

You can modify LOB storage with an ALTER TABLE statement or with online redefinition by using the DBMS_REDEFINITION package.

Oracle recommends that you enable compression, deduplication, or encryption at table creation time. Enabling these features using ALTER TABLE will cause the DDL to read/modify/write the entire LOB column holding a DDL lock the entire time during this potentially long operation.

The SHRINK option is not supported for SecureFiles.

If you have not enabled LOB encryption, compression, or deduplication at create time, Oracle recommends that you use online redefinition to enable them after creation, because this process is more disk-space efficient for changes to these three parameters.



ALTER TABLE [ schema.]table
 [ alter_table_properties
 | column_clauses
 | constraint_clauses
 | alter_table_partitioning
 | alter_external_table_clauses
 | move_table_clause
 ]
   [ enable_disable_clause
   | { ENABLE | DISABLE }
     { TABLE LOCK | ALL TRIGGERS }
   [ enable_disable_clause
   | { ENABLE | DISABLE }
     { TABLE LOCK | ALL TRIGGERS }
   ]...
 ] ;


<column_clauses> ::=
 { { add_column_clause
   | modify_column_clause
   | drop_column_clause
   }
   [ add_column_clause
   | modify_column_clause
   | drop_column_clause
   ]...
 | rename_column_clause
 | modify_collection_retrieval
   [ modify_collection_retrieval ]...
 | modify_LOB_storage_clause
   [ modify_LOB_storage_clause ] ...
 | alter_varray_col_properties
   [ alter_varray_col_properties ]
 }

<modify_LOB_storage_clause> ::=
MODIFY LOB (LOB_item) ( modify_LOB_parameters )

<modify_LOB_parameters> ::=
{ storage_clause
| PCTVERSION integer
| FREEPOOLS integer
| REBUILD FREEPOOLS
| LOB_retention_clause
| LOB_deduplicate_clause
| LOB_compression_clause
| { ENCRYPT encryption_spec | DECRYPT }
| { CACHE
 | { NOCACHE | CACHE READS } [ logging_clause ]
 }
| allocate_extent_clause
| shrink_clause
| deallocate_unused_clause
} ...

Disable deduplication on a SECUREFILE LOB.

SHAIKDB>select table_name,column_name,tablespace_name,index_name,deduplication,securefile,segment_created from user_lobs;

TABLE_NAME COLUMN_NAME       TABLESPACE INDEX_NAME             DEDUPLICATION   SEC SEG
---------- -------------------- ---------- ------------------------------ --------------- --- ---
DEDUP       DESC1       LOBS       SYS_IL0000074709C00002$$      LOB         YES NO
NODEDUP    DESC1       LOBS       SYS_IL0000074721C00002$$      NO         YES NO
COMP       DESC1       LOBS       SYS_IL0000074736C00002$$      LOB         YES NO
DEDUP_PART DESC1       LOBS       SYS_IL0000074712C00002$$      NO         YES N/A
DEDUP_SUB_ DESC1       LOBS       SYS_IL0000074724C00003$$      LOB         YES N/A
PART

SHAIKDB>alter table DEDUP modify lob(desc1) (keep_duplicates cache);

Table altered.

SHAIKDB>select table_name,column_name,tablespace_name,index_name,deduplication,securefile,segment_created from user_lobs;

TABLE_NAME COLUMN_NAME       TABLESPACE INDEX_NAME             DEDUPLICATION   SEC SEG
---------- -------------------- ---------- ------------------------------ --------------- --- ---
DEDUP       DESC1       LOBS       SYS_IL0000074709C00002$$      NO         YES NO
NODEDUP    DESC1       LOBS       SYS_IL0000074721C00002$$      NO         YES NO
COMP       DESC1       LOBS       SYS_IL0000074736C00002$$      LOB         YES NO
DEDUP_PART DESC1       LOBS       SYS_IL0000074712C00002$$      NO         YES N/A
DEDUP_SUB_ DESC1       LOBS       SYS_IL0000074724C00003$$      LOB         YES N/A



SHAIKDB>alter table dedup_sub_part modify lob(desc1) (keep_duplicates);

Table altered.

SHAIKDB>select table_name,column_name,tablespace_name,index_name,deduplication,securefile,segment_created from user_lobs;

TABLE_NAME COLUMN_NAME       TABLESPACE INDEX_NAME             DEDUPLICATION   SEC SEG
---------- -------------------- ---------- ------------------------------ --------------- --- ---
DEDUP       DESC1       LOBS       SYS_IL0000074709C00002$$      NO         YES NO
NODEDUP    DESC1       LOBS       SYS_IL0000074721C00002$$      NO         YES NO
COMP       DESC1       LOBS       SYS_IL0000074736C00002$$      LOB         YES NO
DEDUP_PART DESC1       LOBS       SYS_IL0000074712C00002$$      NO         YES N/A
DEDUP_SUB_ DESC1       LOBS       SYS_IL0000074724C00003$$      NO         YES N/A
PART




Disable LOB-level deduplication on a SECUREFILE LOB column within a single partition.


SHAIKDB>select table_name,partition_name,column_name,tablespace_name,deduplication,securefile,segment_created from user_lob_partitions;

TABLE_NAME PARTITION_NAME         COLUMN_NAME           TABLESPACE DEDUPLICATION   SEC SEG
---------- ------------------------------ -------------------- ---------- --------------- --- ---
DEDUP_PART P1                 DESC1            LOBS      LOB         YES YES
DEDUP_PART P2                 DESC1            LOBS      NO         YES YES
DEDUP_SUB_ P1                 DESC1              NO         YES N/A
PART


SHAIKDB>alter table dedup_part modify partition p1 lob(desc1) ( keep_duplicates cache);

Table altered.

SHAIKDB>select table_name,partition_name,column_name,tablespace_name,deduplication,securefile,segment_created from user_lob_partitions;

TABLE_NAME PARTITION_NAME         COLUMN_NAME           TABLESPACE DEDUPLICATION   SEC SEG
---------- ------------------------------ -------------------- ---------- --------------- --- ---
DEDUP_PART P1                 DESC1            LOBS      NO         YES YES
DEDUP_PART P2                 DESC1            LOBS      NO         YES YES
DEDUP_SUB_ P1                 DESC1              NO         YES N/A
PART



Documentation:

Master Note: Overview of Oracle Large Objects (BasicFiles LOBs and SecureFiles LOBs) (Doc ID 1490228.1)
Oracle® Database SecureFiles and Large Objects Developer's Guide
11g Release 2 (11.2)  Part Number E10645-01 → 4 Using Oracle SecureFiles

Create and manage LOB segments

$
0
0
Create and manage LOB segments


Initializing Persistent LOBs to NULL or Empty

You can set a persistent LOB — ­that is, a LOB column in a table, or a LOB attribute in an object type that you defined— to be NULL or empty:

If a LOB column is initialized with EMPTY_CLOB() or EMPTY_BLOB(), then no LOB value exists, not even NULL. The row holds a LOB locator only. No additional LOB storage is used.


LOB storage characteristics that can be specified for a LOB column or a LOB attribute include the following:
  • TABLESPACE
  • PCTVERSION or RETENTION
  • Note that you can specify either PCTVERSION or RETENTION for BASICFILE LOBs, but not both. For SECUREFILE LOBs, only the RETENTION parameter can be specified.
  • CACHE/NOCACHE/CACHE READS
  • LOGGING/NOLOGGING
  • CHUNK
  • ENABLE/DISABLE STORAGE IN ROW
  • STORAGE

CHUNK

A chunk is one or more Oracle blocks




Setting a Persistent LOB to Empty



SHAIKDB>insert into dedup values (1,empty_blob());

1 row created.



SHAIKDB>create table lob1 (id number,desc1 blob)  lob(desc1) store as bfilelob (tablespace lobs chunk 4k pctversion 5 storage (maxextents 5));

Table created.




DBMS_LOB:

Overview

DBMS_LOB can read and modify BLOBs, CLOBs, and NCLOBs; it provides read-only operations for BFILEs. The bulk of the LOB operations are provided by this package.


Documentation:
a)Oracle® Database SecureFiles and Large Objects Developer's Guide
11g Release 2 (11.2)  Part Number E10645-01 → 11 LOB Storage


b)Oracle® Database PL/SQL Packages and Types Reference
11g Release 2 (11.2)
-- Part Number E10577-03 --> 79 DBMS_LOB

How do you audit the “SYS” operations in Oracle Database?

$
0
0
How do you audit the “SYS” operations in Oracle Database?

The SYS user's actions cannot be audited with Standard or Fine Grained Auditing?

Fix:-
SYS actions are only audited using parameter AUDIT_SYS_OPERATIONS=TRUE.

Implement fine-grained access control

$
0
0

Auditing is the monitoring and recording of selected user database actions, from both database users and nondatabase users


benefits:
  • Security. Associating a policy with a database table, view, or synonym can solve a potentially serious application security problem. Suppose a user is authorized to use an application, and then drawing on the privileges associated with that application, wrongfully modifies the database by using an ad hoc query tool, such as SQL*Plus. By attaching security policies directly to tables, views, or synonyms, fine-grained access control ensures that the same security is in force, no matter how a user accesses the data.
  • Simplicity. You add the security policy to a table, view, or synonym only once, rather than repeatedly adding it to each of your table-based, view-based, or synonym-based applications.
  • Flexibility. You can have one security policy for SELECT statements, another for INSERT statements, and still others for UPDATE and DELETE statements. For example, you might want to enable Human Resources clerks to have SELECT privileges for all employee records in their division, but to update only salaries for those employees in their division whose last names begin with A through F. Furthermore, you can create multiple policies for each table, view, or synonym.



Fine-grained auditing records are stored in the SYS.FGA_LOG$ table. To find the records have been generated for the audit policies that are in effect, you can query the DBA_FGA_AUDIT_TRAIL view. The DBA_COMMON_AUDIT_TRAIL view combines both standard and fine-grained audit log records. In addition, you can use the V$XML_AUDIT_TRAIL view to find fine-grained audit records that were written in XML formatted files

The DBA_COMMON_AUDIT_TRAIL view includes the contents of the V$XML_AUDIT_TRAIL dynamic view for standard and fine-grained audit records.

DBMS_FGA PL/SQL Package

To manage a fine-grained audit policy, you use the DBMS_FGA PL/SQL package. This package enables you to add all combinations of SELECT, INSERT, UPDATE, and DELETE statements to one policy. You also can audit MERGE statements, by auditing the underlying actions of INSERT and UPDATE. To audit MERGE statements, configure fine-grained access on the INSERT and UPDATE statements. Only one record is generated for each policy for successful MERGE operations. To administer fine-grained audit policies, you must have the EXECUTE privilege on the DBMS_FGA package

If any rows returned from a query match the audit condition that you define, then Oracle Database inserts an audit entry into the fine-grained audit trail. This entry excludes all the information that is reported in the regular audit trail. In other words, only one row of audit information is inserted into the audit trail for every fine-grained audit policy that evaluates to true.


After you create the fine-grained audit policy, it does not reside in any specific schema, although the definition for the policy is stored in the SYS.FGA$ data dictionary table.
You cannot modify a fine-grained audit policy after you have created it. If you need to modify the policy, drop it and then recreate it.
The syntax for the ADD_POLICY procedure is:
DBMS_FGA.ADD_POLICY(
  object_schema      VARCHAR2,
  object_name        VARCHAR2,
  policy_name        VARCHAR2,
  audit_condition    VARCHAR2,
  audit_column       VARCHAR2,
  handler_schema     VARCHAR2,
  handler_module     VARCHAR2,
  enable             BOOLEAN,
  statement_types    VARCHAR2,
  audit_trail        BINARY_INTEGER IN DEFAULT,
  audit_column_opts  BINARY_INTEGER IN DEFAULT);

  • object_schema: Specifies the schema of the object to be audited. (If NULL, the current log-on user schema is assumed.)
  • object_name: Specifies the name of the object to be audited.
  • policy_name: Specifies the name of the policy to be created. Ensure that this name is unique.
  • audit_condition: Specifies a Boolean condition in a row. NULL is allowed and acts as TRUE. See "Auditing Specific Columns and Rows" for more information. If you specify NULL or no audit condition, then any action on a table with that policy creates an audit record, whether or not rows are returned
  • audit_column: Specifies one or more columns to audit, including hidden columns. If set to NULL or omitted, all columns are audited. These can include Oracle Label Security hidden columns or object type columns. The default, NULL, causes audit if any column is accessed or affected.
  • handler_schema: If an alert is used to trigger a response when the policy is violated, specifies the name of the schema that contains the event handler. See also "Tutorial: Adding an E-Mail Alert to a Fine-Grained Audit Policy".
  • handler_module: Specifies the name of the event handler. Include the package the event handler is in. The default, NULL, uses the current schema.This function is invoked only after the first row that matches the audit condition in the query is processed. If the procedure fails with an exception, then the user SQL statement fails as well.
  • enable: Enables or disables the policy using true or false. If omitted, the policy is enabled. The default is TRUE.
  • statement_types: Specifies the SQL statements to be audited: INSERT, UPDATE, DELETE, or SELECT only.
  • audit_trail: Specifies the destination (DB or XML) of fine-grained audit records. Also specifies whether to populate LSQLTEXT and LSQLBIND in FGA_LOG$. However, be aware that sensitive data, such as credit card information, can be recorded in clear text. See "Auditing Sensitive Information" for how you can handle this scenario.
  • audit_column_opts: If you specify more than one column in the audit_column parameter, then this parameter determines whether to audit all or specific columns.
Using DBMS_FGA.ADD_POLICY to Create a Fine-Grained Audit Policy




SHAIKDB>BEGIN
DBMS_FGA.add_policy(
object_schema => 'HR',
object_name => 'EMPLOYEES',
policy_name => 'EMPLOYEES_CHK_AUDIT_SRC',
audit_condition => 'SALARY > 2500',
audit_column => 'SALARY');
END;
/


SHAIKDB>exec dbms_fga.drop_policy(policy_name => 'EMPLOYEES_CHK_AUDIT_SRC',object_schema => 'HR',object_name => 'EMPLOYEES');

PL/SQL procedure successfully completed.


SHAIKDB>grant execute on dbms_fga to lob;

Grant succeeded.

SHAIKDB>grant select on hr.employees to lob;

Grant succeeded.

SHAIKDB>show user
USER is "LOB"


SHAIKDB>exec dbms_fga.add_policy(object_schema=>'HR',object_name=>'EMPLOYEES',policy_name=>'Audit_Select',STATEMENT_TYPES=>'SELECT');

PL/SQL procedure successfully completed.

SHAIKDB>select * from user_audit_policies;

no rows selected



SHAIKDB>show user
USER is "SYS"

SHAIKDB>col OBJECT_SCHEMA for a10
SHAIKDB>col OBJECT_NAME for a10
SHAIKDB>col POLICY_OWNER for a10

SHAIKDB>select OBJECT_SCHEMA,OBJECT_NAME,POLICY_OWNER,POLICY_NAME,ENABLED,SEL,AUDIT_TRAIL from dba_audit_policies;

OBJECT_SCH OBJECT_NAM POLICY_OWN POLICY_NAME           ENA SEL AUDIT_TRAIL
---------- ---------- ---------- ------------------------------ --- --- ------------
HR       EMPLOYEES  LOB     AUDIT_SELECT           YES YES DB+EXTENDED


Now lets verify the select conditions works:

Before running the SELECT statement no audit data was found.
SHAIKDB>select * from dba_fga_audit_trail;

no rows selected


SHAIKDB>col dbuid format a10
col lsqltext format a66
col ntimestamp# format a15

SHAIKDB>
SELECT DBUID, LSQLTEXT, NTIMESTAMP# FROM SYS.FGA_LOG$ SHAIKDB;

no rows selected


SELECT the data:

SHAIKDB>show user
USER is "LOB"
SHAIKDB>select salary from hr.employees where employee_id=100;

    SALARY
----------
    24000


Afterrunning the SELECT statement audit data was found.


SHAIKDB>show user
USER is "SYS"


SHAIKDB>SELECT DBUID, LSQLTEXT, NTIMESTAMP# FROM SYS.FGA_LOG$

DBUID       LSQLTEXT                                 NTIMESTAMP#
---------- ------------------------------------------------------------------ ---------------
LOB       select salary from hr.employees where employee_id=100          26-SEP-15 07.36
                                        .01.161911 AM



SHAIKDB>select * from dba_fga_audit_trail;
    400099 26-SEP-15 LOB
oracle
collabn1.shaiksameer

oracle
HR       EMPLOYEES  AUDIT_SELECT           1115602
select salary from hr.employees where employee_id=100


SELECT    26-SEP-15 03.36.01.161911 AM -04:00                                                       0 24598                   13
    2                 1685298195




DISABLE Policy:

SHAIKDB>exec dbms_fga.disable_policy(object_schema=>'HR',object_name=>'EMPLOYEES',policy_name=>'AUDIT_SELECT');

PL/SQL procedure successfully completed.


SHAIKDB>select OBJECT_SCHEMA,OBJECT_NAME,POLICY_OWNER,POLICY_NAME,ENABLED,SEL from dba_audit_policies;

OBJECT_SCH OBJECT_NAM POLICY_OWN POLICY_NAME           ENA SEL
---------- ---------- ---------- ------------------------------ --- ---
HR       EMPLOYEES  LOB     AUDIT_SELECT           NO YES



Drop the policy:


SHAIKDB>exec dbms_fga.drop_policy(object_schema=>'HR',object_name=>'EMPLOYEES',policy_name=>'AUDIT_SELECT');

PL/SQL procedure successfully completed.


SHAIKDB>select OBJECT_SCHEMA,OBJECT_NAME,POLICY_OWNER,POLICY_NAME,ENABLED,SEL from dba_audit_policies;


no rows selected

Create the policy with audit conditions and audit column options:

Test the select condition:

SHAIKDB>exec dbms_fga.add_policy(object_schema=>'HR',object_name=>'EMPLOYEES',policy_name=>'audit_salary_col',audit_condition=>'salary>1000', audit_column=>'SALARY',statement_types=>'SELECT,INSERT');

PL/SQL procedure successfully completed.


SHAIKDB>select OBJECT_SCHEMA,OBJECT_NAME,POLICY_OWNER,POLICY_NAME,ENABLED,SEL from dba_audit_policies;

OBJECT_SCH OBJECT_NAM POLICY_OWN POLICY_NAME           ENA SEL
---------- ---------- ---------- ------------------------------ --- ---
HR       EMPLOYEES  LOB     AUDIT_SALARY_COL       YES YES

SHAIKDB>show user
USER is "LOB"

SHAIKDB>select * from hr.employees where salary>10000;

EMPLOYEE_ID FIRST_NAME        LAST_NAME           EMAIL            PHONE_NUMBER      HIRE_DATE JOB_ID       SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID     SSN
----------- -------------------- ------------------------- ------------------------- -------------------- --------- ---------- ---------- -------------- ---------- ------------- ----------
   201 Michael        Hartstein           MHARTSTE            515.123.5555      17-FEB-04 MK_MAN        13000    100           20
   205 Shelley        Higgins           SHIGGINS            515.123.8080      07-JUN-02 AC_MGR        12008    101          110




SHAIKDB>SELECT DBUID, LSQLTEXT, NTIMESTAMP# FROM SYS.FGA_LOG$;

DBUID       LSQLTEXT                                 NTIMESTAMP#
---------- ------------------------------------------------------------------ ---------------
LOB       select salary from hr.employees where employee_id=100          26-SEP-15 07.36
                                        .01.161911 AM

LOB       select * from hr.employees where salary>10000             26-SEP-15 08.11
                                        .15.378093 AM

col SQL_TEXT for a30
col os_user for a10
SHAIKDB>select timestamp,object_schema,object_name,policy_name,sql_bind,sql_text from dba_fga_audit_trail;


TIMESTAMP OBJECT_SCH OBJECT_NAM POLICY_NAME              SQL_BIND              SQL_TEXT
--------- ---------- ---------- ------------------------------ ------------------------------ ------------------------------
26-SEP-15 HR         EMPLOYEES    AUDIT_SELECT       select salary from hr.employees where employee_id=100

26-SEP-15 HR         EMPLOYEES    AUDIT_SALARY_COL   select * from hr.employees where salary>10000



Test the insert condition:


SHAIKDB>grant select,insert,update,delete on hr.employees to pfay;

Grant succeeded.

SHAIKDB>alter user pfay identified by pfay;

User altered.

SHAIKDB>grant create session to pfay;

Grant succeeded.

SHAIKDB>conn pfay/pfay
Connected.

SHAIKDB>show user
USER is "PFAY"



SHAIKDB>insert into hr.employees values (220,'SHAIK','SAMEER','shaiksameer','515.123.4512',sysdate,'AD_VP',50000,null,null,100,null);

1 row created.

SHAIKDB>commit;

Commit complete.



TIMESTAMP OBJECT_SCH OBJECT_NAM POLICY_NAME              SQL_BIND              SQL_TEXT
--------- ---------- ---------- ------------------------------ ------------------------------ ------------------------------
26-SEP-15 HR         EMPLOYEES    AUDIT_SELECT                             select salary from hr.employee
                                                s where employee_id=100

26-SEP-15 HR         EMPLOYEES    AUDIT_SALARY_COL                         select * from hr.employees whe
                                                re salary>10000

26-SEP-15 HR         EMPLOYEES    AUDIT_SALARY_COL                         insert into hr.employees selec
                                                t * from hr.employees where em
                                                ployee_id=100

26-SEP-15 HR         EMPLOYEES    AUDIT_SALARY_COL                         select * from hr.employees whe
                                                re employee_id=100

26-SEP-15 HR         EMPLOYEES    AUDIT_SALARY_COL                         select * from EMP_DETAILS_VIEW
26-SEP-15 HR         EMPLOYEES    AUDIT_SALARY_COL                         insert into hr.employees value
                                                s (220,'SHAIK','SAMEER','shaik
                                                sameer','515.123.4512',sysdate
                                                ,'AD_VP',50000,null,null,100,n
                                                ull)


6 rows selected.


Data Dictionary Views That Display Information about the Database Audit Trail
View
Description
ALL_AUDIT_POLICIES
Describes the fine-grained auditing policies on the tables and views accessible to the current user
ALL_AUDIT_POLICY_COLUMNS
Describes the fine-grained auditing policy columns on the tables and views accessible to the current user.
ALL_DEF_AUDIT_OPTS
Lists default object-auditing options that are to be applied when objects are created
AUDIT_ACTIONS
Describes audit trail action type codes
DBA_AUDIT_EXISTS
Lists audit trail entries produced BY AUDIT NOT EXISTS
DBA_AUDIT_MGMT_CLEAN_EVENTS
Displays the history of purge events. Periodically, as user SYS connected with the SYSDBA privilege, you should delete the contents of this view so that it does not grow too large. For example:
DELETE FROM DBA_AUDIT_MGMT_CLEAN_EVENTS;
DBA_AUDIT_MGMT_CLEANUP_JOBS
Displays the currently configured audit trail purge jobs
DBA_AUDIT_MGMT_CONFIG_PARAMS
Displays the currently configured audit trail properties that are used by the DBMS_AUDIT_MGMT PL/SQL package
DBA_AUDIT_MGMT_LAST_ARCH_TS
Displays the last archive timestamps that have set for audit trail purges.
DBA_AUDIT_OBJECT
Lists audit trail records for all objects in the system
DBA_AUDIT_POLICIES
Lists all the fine-grained auditing policies on the system
DBA_AUDIT_SESSION
Lists all audit trail records concerning CONNECT and DISCONNECT
DBA_AUDIT_POLICY_COLUMNS
Describes the fine-grained auditing policy columns on the tables and views throughout the database.
DBA_AUDIT_STATEMENT
Lists audit trail records concerning GRANT, REVOKE, AUDIT, NOAUDIT, and ALTER SYSTEM statements throughout the database
DBA_AUDIT_TRAIL
Lists all standard audit trail entries in the AUD$ table
DBA_COMMON_AUDIT_TRAIL
Combines standard and fine-grained audit log records, and includes SYS and mandatory audit records written in XML format
DBA_FGA_AUDIT_TRAIL
Lists audit trail records for fine-grained auditing.
DBA_OBJ_AUDIT_OPTS
Describes auditing options on all objects
DBA_PRIV_AUDIT_OPTS
Describes current system privileges being audited across the system and by user
DBA_STMT_AUDIT_OPTS
Describes current statement auditing options across the system and by user
USER_AUDIT_OBJECT
Lists audit trail records for statements concerning objects that are accessible to the current user
USER_AUDIT_POLICIES
Describes the fine-grained auditing policy columns on the tables and views accessible to the current user.
USER_AUDIT_SESSION
Lists all audit trail records concerning connections and disconnections for the current user
USER_AUDIT_STATEMENT
Lists audit trail records concerning GRANT, REVOKE, AUDIT, NOAUDIT, and ALTER SYSTEM statements issued by the user
USER_AUDIT_TRAIL
Lists all standard audit trail entries in the AUD$ table relating to the current user
USER_OBJ_AUDIT_OPTS
Describes auditing options on all objects owned by the current user
V$LOGMNR_CONTENTS
Contains log history information. To query this view, you must have the SELECT ANY TRANSACTION privilege.
V$XML_AUDIT_TRAIL
Shows standard, fine-grained, SYS, and mandatory audit records written in XML format files.


Manually Purging the Audit Trail

You can manually purge the audit trail right away, without scheduling a purge job. Similar to a purge job, you can purge audit trail records that were created before an archive timestamp date or all the records in the audit trail.
Note the following about the DBMS_AUDIT_MGMT.CLEAN_AUDIT_TRAIL

Alternatively, to delete all audit records from the audit trail, enter the following statement:
DELETE FROM SYS.AUD$;

Oracle® Database Security Guide 11g Release 2 (11.2) Part Number E10574-02  --> 9Verifying Security Access with Auditing
Viewing all 191 articles
Browse latest View live