Search This Blog

Total Pageviews

Wednesday, 4 December 2024

How to create Oracle Database Services via srvctl for PDB?



How to create Oracle Database Services via srvctl for PDB?


=====



tnsnames.ora


SQL> show parameter unique

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      oradb




SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 PDB1                           READ WRITE NO
SQL>






/u01/app/oracle/product/19.0.0/db_1/network/admin


PRODB_SRVP=
 (description=
   (address_list=
     (address = (protocol = TCP)(host = 192.168.1.120)(port = 1521))
   )
 (connect_data =
   (service_name=PRODB_SRVP)
 )
)





http://anuj-singh.blogspot.com/2012/03/srvctl-command-reference.html


SYNTAX ----


srvctl add service -d -s [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}][-q {true|false}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}][-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}][-z ] [-w ] [-t ] [-f]

srvctl config service -d [-s ] [-v]
 srvctl start service -d [-s ""] [-o ]
 srvctl stop service -d [-s ""] [-f]
 srvctl status service -d [-s ""] [-f] [-v]
 srvctl enable service -d -s ""
 srvctl disable service -d -s ""
 
 srvctl modify service -d -s [-l [PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}][-q {true|false}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z ] [-w ] [-t ]

srvctl remove service -d -s [-f]


srvctl add service -db  -pdb  -service  
-preferred 
-available 
-stopoption IMMEDIATE
-notification true
-drain_timeout 300 


[oracle@srv1 admin]$ srvctl add service -d oradb -s PRODB_SRVP -l primary -pdb PDB1 -m BASIC -e SELECT -w 1 -z 180 -q TRUE

[oracle@srv1 admin]$ srvctl start service -d oradb -s PRODB_SRVP

[oracle@srv1 admin]$ srvctl status service -d oradb -s PRODB_SRVP
Service PRODB_SRVP is running



====

Check the resource status !!!

for services .. 

 crsctl status resource -t|grep -i -b3 svc
 
 
srvctl config service -d oradb|grep -i 'service name'



=====



set linesize 100 pages 0
alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS';

select 
'SERVICE_ID ..........................................: '||SERVICE_ID ,                
'NAME ................................................: '||NAME   ,                    
'kill ................................................: '||NAME_HASH   ,               
'NAME_HASH ...........................................: '||NETWORK_NAME  ,             
'CREATION_DATE .......................................: '||CREATION_DATE     ,         
'CREATION_DATE_HASH ..................................: '||CREATION_DATE_HASH  ,       
'GOAL ................................................: '||GOAL  ,                     
'DTP .................................................: '||DTP,                        
'AQ_HA_NOTIFICATION  .................................: '||AQ_HA_NOTIFICATION  ,       
'CLB_GOAL ............................................: '||CLB_GOAL   ,                
'COMMIT_OUTCOME ......................................: '||COMMIT_OUTCOME ,            
'RETENTION_TIME ......................................: '||RETENTION_TIME ,            
'REPLAY_INITIATION_TIMEOUT  ..........................: '||REPLAY_INITIATION_TIMEOUT  ,
'SESSION_STATE_CONSISTENCY ...........................: '||SESSION_STATE_CONSISTENCY , 
'GLOBAL ..............................................: '||GLOBAL,                     
'PDB  ................................................: '||PDB ,                       
'SQL_TRANSLATION_PROFILE .............................: '||SQL_TRANSLATION_PROFILE   , 
'MAX_LAG_TIME.........................................: '||MAX_LAG_TIME,               
'STOP_OPTION  ........................................: '||STOP_OPTION ,               
'FAILOVER_RESTORE ....................................: '||FAILOVER_RESTORE  ,         
'DRAIN_TIMEOUT .......................................: '||DRAIN_TIMEOUT ,             
'TABLE_FAMILY_ID .....................................: '||TABLE_FAMILY_ID   ,         
'CON_ID ..............................................: '||CON_ID   
from gv$services
 ;










[grid@srv1 ~]$ lsnrctl services|grep -i PRODB_SRVP
Service "PRODB_SRVP" has 1 instance(s).



[oracle@srv1 admin]$ sqlplus anuj/anuj123@PRODB_SRVP

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 4 16:53:31 2024
Version 19.3.0.0.0

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

Last Successful login time: Wed Dec 04 2024 16:28:39 +04:00

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL>

 

No comments:

Oracle DBA

anuj blog Archive