Dbms_service !!!
hello..
i have added a new service using the pl/sql package dbms_service.
execute dbms_service.create_service('INS','INS');
execute dbms_service.start_service('INS');
the service name is present in v$services and dba_services.
But once i bounce the db, i dont find the service INS running.
there is only entry in dba_services, but not in v$services.
and i will 've to start this service manually.
what is tht am supposed to do, to start the service INS automatically along with startup of db. ??
Thanks,
JJ
hello Satya,
that link conveys how to create a service.
i have already created the service, the problem is after each startup , i hve to manually start the service using dbms_service.start_service
anybody out there with sme clue ???
TIA,
jj
Similar Messages
-
Creating and using a service using DBMS_SERVICE
Good day all,
System Spec:
Oracle Database 10g 10.2.0.4.0
Red Hat Enterprise Linux Server release 5.3 (Tikanga) 2.6.18 194.11.4.el5 (64-bit)
I'm trying to create a service that an application will use to connect to a single instance called ORADB1.
I've done the following:
EXECUTE DBMS_SERVICE.CREATE_SERVICE('TEST1', 'TEST1')
ALTER SYSTEM SET SERVICE_NAMES=ORADB1, TEST1 SCOPE=BOTH
Connection descriptor (in tnsnames.ora) is: TEST1=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host.mycorp.com)(PORT=1527))(CONNECT_DATA=(SERVICE_NAME=TEST1)))
EXECUTE DBMS_SERVICE.START_SERVICE('TEST1','ORADB1')
tnsping gives me the following result:
TNS Ping Utility for Solaris: Version 10.2.0.4.0 - Production on 26-NOV-2010 11:38:04
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
/home/user1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host.mycorp.com)(PORT=1527))(CONNECT_DATA=(SERVICE_NAME=TEST1)))
OK (0 msec)
When I try to connect to the service (via TOAD 10.0.0.41) I get: "ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"
The DBA has bounced the database and still no joy.
I've got a feeling I'm missing something simple. Can anybody please help me to get this service working ?You are creating the service twice once with SERVICE_NAMES parameter and once with DBMS_SERVICE.
You just need to set SERVICE_NAMES parameter and update tnsnames.ora:
SQL> alter system set service_names='TESTXE,XE' ;
System altered.and
C:\>tnsping TESTXE
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 26-NOV-2010 11:51:13
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
C:\oraclexe\app\oracle\product\10.2.0\server\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED)
SERVICE_NAME = TESTXE)))
OK (10 msec)
C:\>sqlplus hr/hr@TESTXE
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Nov 26 11:51:23 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> select name from v$database;
NAME
XE
SQL> exitThis works because in my environment XE is using default listener configuration (port 1521 and TCP/IP).
You may need to set instance parameter LOCAL_LISTENER for your listener configuration: http://download.oracle.com/docs/cd/B19306_01/network.102/b14212/listenercfg.htm#sthref1032
Edited by: P. Forstmann on 26 nov. 2010 12:03 -
Execute DBMS_SERVICE in standby database
Hi all.
I have a 2 nodes RAC with 10.2.0.4.0 and 1 physical standby in red hat.
I create a trigger to start services in standby in case of switchover. I do a switchover and create the services but...
when i go back and execute a switchover again i have services started in Primary and Standby. !!!
I need to stop, drop, kill services in standby because some connections wants to connect to standby database...
execute dbms_service in standby and I have this error.
SQL> exec dbms_service.stop_service('OSAPP3_GMP.bancocredicoop.coop');
BEGIN dbms_service.stop_service('OSAPP3_GMP.bancocredicoop.coop'); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00201: identifier 'DBMS_SERVICE.STOP_SERVICE' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
I don't know if i make a mistake in execution of procedure or I can't execute this procedure in standby database.
There is another way to stop service in standby??
Thanks and sorry by my english.I used to use role change triggers to start services, but there were always problems.
Much better to use Dataguard Broker and have the services managed by CRS. When you switchover with Dataguard Broker it will tell CRS to stop the service on the new standby and start on the new primary. -
RAC: Service started not in the right instance
Hello,
I added today two instances (ACCMEAS3, ACCMEAS4) to a RAC databases (10gR2). The system has now 4 nodes. The new configuration of my service is:
$>-RAC>-ACCMEAS3:$ srvctl config service -d ACCMEAS
ACCMEAS_S PREF: ACCMEAS3 AVAIL: ACCMEAS4
$>-RAC>-ACCMEAS3:$srvctl status service -d ACCMEAS
Service ACCMEAS_S is running on instance(s) ACCMEAS3
This is the actual configuration in the CRS.
Nevertheless the ACCMEAS2 still has the service, despite I have bounced the instance:
(info from a listener):
Service "ACCMEAS_S" has 2 instance(s).
Instance "ACCMEAS2", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=nodea)(PORT=1574))
Instance "ACCMEAS3", status READY, has 2 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=nodeb)(PORT=1574))
"DEDICATED" established:1639 refused:0 state:ready
LOCAL SERVER
The only way to avoid this is to put ACCMEAS2 down.
The service is configured TAF: Basic-Select, CLB_GOAL: LONG,GOAL:NONE
The connection string for info purpose:
datab=(
DESCRIPTION=
(ADDRESS= (PROTOCOL=TCP) (HOST=nodea-v) (PORT=1574) )
(ADDRESS= (PROTOCOL=TCP) (HOST=nodeb-v) (PORT=1574) )
(ADDRESS= (PROTOCOL=TCP) (HOST=nodec-v) (PORT=1574) )
(ADDRESS= (PROTOCOL=TCP) (HOST=noded-v) (PORT=1574) )
(LOAD_BALANCE=off)
(ENABLE=BROKEN)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=accmeas_s)
(FAILOVER_MODE=
(TYPE=SELECT)
(METHOD=BASIC)
In the future we would like to have all instances as possible spares, that's why this definition in the tnsnames.ora.
What makes the service to get started on a instance not defined for?
Thanks for your help!The workaround I have found is to use dbms_service.stop_service. This stops the service on the instance 2 and makes everything coherent with the CRS.
Ruben -
ORA-01152 error while creating db from custom template
I have a database based on the "general purpose/transaction processing" db, but with a custom tablespace/data added. I have attempted to clone this database by using dbca to create a custom template (including data) from this database. The template creation appears to be successful -- however, when I use dbca to try to create a new db from this custom template, I get the following error when dbca attempts to initialize the instance:
ORA-01152: file 5 was not restored from a sufficiently old backup
ORA-01110: data file 5: <path to my custom tablespace .dbf>
If I select "ignore" at this point, I get further errors, the next error is
ORA-06550: line 1, column 7: PLS-00201: Identifier 'DBMS_SERVICE.DELETE_SERVICE' must be declared
I'm using 11gR2, and am relatively inexperienced on the dba side, any help appreciated.
Thanks,
BenUpdate: I had unintentionally left my custom tablespace in READONLY state after an earlier experiment with transportable tablespaces. After putting the tablespace back into READ WRITE mode and creating a new template, I was successfully able to create a new db from the template.
I'm still a little curious why this procedure wouldn't work properly with a READONLY tablespace, however.
Ben -
ORA-01033: ORACLE initialization or shutdown in progress / TAF
Hi experts,
I have the following environment:
+ 2 Linux Redhat 5.7 0n X86/64 named dwh and stb and Oracle 11.2.0.2,
+ Database on dwh is primary and on stb is standby
the listener on dwh:
ADR_BASE_LISTENER=/u00/app/oracle
LISTENER =
(ADDRESS_LIST =
# for external procedure calls, create a separate listener
# See basenv_user_guide.pdf for details (chapter of listener.ksh)
(ADDRESS =
(PROTOCOL = TCP)
(Host = dwh )
(Port = 1521)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
# Next line is necessary for dataguard >= 10g
(GLOBAL_DBNAME = strm_site1_DGMGRL)
(SID_NAME = STRM )
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1 )
)the service_names parameter on dwh:
SQL> show parameter service
NAME TYPE VALUE
service_names string STRM
[oracle@dwh admin]$ lsnrctl status
[oracle@dwh admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 14-SEP-2011 17:32:43
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=TCP)(Host=dwh)(Port=1521))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 14-SEP-2011 12:11:15
Uptime 0 days 5 hr. 21 min. 28 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dwh)(PORT=1521)))
Services Summary...
Service "STRMXDB" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm_site1" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm_site1_DGB" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm_site1_DGMGRL" has 1 instance(s).
Instance "STRM", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
the listener on stb:
[oracle@stb admin]$ cat listener.ora
ADR_BASE_LISTENER=/u00/app/oracle
LISTENER =
(ADDRESS_LIST =
# for external procedure calls, create a separate listener
# See basenv_user_guide.pdf for details (chapter of listener.ksh)
(ADDRESS = (PROTOCOL = TCP) (Host = stb ) (Port = 1521)
SID_LIST_LISTENER =
(SID_DESC =
# Next line is necessary for dataguard >= 10g
(GLOBAL_DBNAME = strm_site2_DGMGRL)
(SID_NAME = STRM )
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1 )
)the service_names parameter on stb:
SQL> show parameter service
NAME TYPE VALUE
service_names string STRM
[oracle@stb admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 14-SEP-2011 17:37:23
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=TCP)(Host=stb)(Port=1521))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 14-SEP-2011 12:12:39
Uptime 0 days 5 hr. 24 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=stb)(PORT=1521)))
Services Summary...
Service "strm" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm_site2" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm_site2_DGB" has 1 instance(s).
Instance "STRM", status READY, has 1 handler(s) for this service...
Service "strm_site2_DGMGRL" has 1 instance(s).
Instance "STRM", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfullyMy tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0.2/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
STRM=
(DESCRIPTION=
(LOAD_BALANCE=on)
(FAILOVER=on)
(ADDRESS=(PROTOCOL=tcp)(HOST=dwh)(PORT=1521))
(ADDRESS=(PROTOCOL=tcp)(HOST=stb)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=strm)
(FAILOVER_MODE=(TYPE=select)(METHOD=basic))
STRM_SITE1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dwh)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = STRM_SITE1)
STRM_SITE2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = stb)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = STRM_SITE2)
)My Problem:
C:\Documents and Settings\thai>sqlplus scott/scott@STRM
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 14 17:49:51 2011
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
Process ID: 0
Session ID: 0 Serial number: 0Login with
sqlplus sys/****@STRM as sysdbaraises no problem!
What I have done wrong? Please, help!
regards
hqt200475
Edited by: hqt200475 on Sep 14, 2011 9:04 AMIf I understand the second part of the question correctly you can use DBMS_SERVICE to create an alias on both servers.
Then depending upon the ROLE they are in you can just connect.
First an entry need to be added to the client tnsnames.ora that uses a SERVICE_NAME instead of a SID.
ernie =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary.host)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = standby.host)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ernie)
)Next the service 'ernie' needs to be created manually on the primary database.
BEGIN
DBMS_SERVICE.CREATE_SERVICE('ernie','ernie');
END;
/After creating the service needs to be manually started.
BEGIN
DBMS_SERVICE.START_SERVICE('ernie');
END;Several of the default parameters can now be set for 'ernie'.
BEGIN
DBMS_SERVICE.MODIFY_SERVICE
('ernie',
FAILOVER_METHOD => 'BASIC',
FAILOVER_TYPE => 'SELECT',
FAILOVER_RETRIES => 200,
FAILOVER_DELAY => 1);
END;
/Finally a database STARTUP trigger should be created to ensures that this service is only offered if the database is primary.
CREATE TRIGGER CHECK_ERNIE_START AFTER STARTUP ON DATABASE
DECLARE
V_ROLE VARCHAR(30);
BEGIN
SELECT DATABASE_ROLE INTO V_ROLE FROM V$DATABASE;
IF V_ROLE = 'PRIMARY' THEN
DBMS_SERVICE.START_SERVICE('ernie');
ELSE
DBMS_SERVICE.STOP_SERVICE('ernie');
END IF;
END;
/Check the status using lsnrctl status
/home/oracle: >lsnrctl status
Service "ernie" has 1 instance(s).
erine is from the Oracle example, you can add whatever you want and then if you do a switchover or failover it is transparent to your users.
See this for more details
http://download.oracle.com/docs/cd/E11882_01/appdev.112/e16760/d_serv.htm
Best Regards
mseberg -
How to remove a dispatcher with a specific index (conf_indx)
Hi,
A few details:
We are on 11.2.0.3 linux 64bit.
We use both dedicated and shared connection.
We have many environments (an environment consists of many schemas) in a single DB.
For each environment we create at least one service (we know # of services is limited to ~150 in 11.2) - in example for environment with suffix LAB1 we create a service called DB_LAB1
in example:
exec dbms_service.create_service('DB_LAB1','DB_LAB1');
exec dbms_service.start_service('DB_LAB1');
For clients to be able to connect to the service_name using shared mode - we also create a dispatcher per environment - serving that specific service -
in example:
alter system set dispatchers='(index=30)(protocol=tcp)(service=DB_LAB1)(dispatchers=1)'
I have a few environments which I would like to remove - including their services and dispatchers.
removing the services is easy using dbms_service - however I did not find a way to remove/delete a dispatcher with a specific index.
Say I have conf_indx 1..50 used and I would like to remove conf_indx=30 (the one which I created above) - how can I do that?
Stopping the dispatcher process (Dxxx) does not remove the row from v$dispatcher_config - it only shows that the number of dispatchers for that row is 0.
Bottom line - how to remove a specific dispatcher with a specific dispatcher-index - without affecting all the other dispatchers which I would like to preserve?
Thanks.
MorOk, but how does one remove some of the applications that are appear in the context menu for a given file type? Is there an asc file which can be edited?
For example, in my system a PDF can be opened with over 10 applications. I would like to see just the three ones I use: Acrobat, Skim and Preview.
Thanks in advance. -
Oracle10gR2
RHEL 4AS 64-bit
Hello all,
I have configured TAF with FAN and I have got it to work. Here are the steps that I did to make it work.
1. Create a service with srvctl
2. Start the service with srvctl
3. exceute the dbms_service.modify_service package
4. Add the new service entry into the tnsnames.ora file
I tested it and it all worked fine. NOW, my question is I need to get it to work at the general user level. What I mean is if bob/bob@db1 connects to the database and issues a select query and then the instance is shutdown it doesn't failover...it looses the connection. How can I get it to work at this level? My current settings are SELECT and BASIC. THe failover works only when you login as SYSTEM, like the many docs out there show.
Any ideas
ThanksOk, so my question is at what level does it need to be set at? The database or instance or both? This is how I have it setup currently.
PROD =
(DESCRIPTION =
(LOAD_BALANCE = ON)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = galapagos-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = humboldt-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = TAF)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 1)
TAF.fprc.ophth.wisc.edu =
(DESCRIPTION =
(LOAD_BALANCE = ON)
(FAILOVER = ON)
(ADDRESS = (PROTOCOL = TCP)(HOST = galapagos-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = humboldt-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = TAF)
PROD2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = humboldt-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
(INSTANCE_NAME = PROD2)
PROD1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = galapagos-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PROD)
(INSTANCE_NAME = PROD1)
Do I also need to add the lines in PROD1 and PROD2??
Thanks -
How to use oracle servcies in roacle 10g rac
hi all,
I want to know how to use SERVICES in oracle 10g rac.I know how to create servcies i.e using srvctl create servcies or DBMS_SERVICES.
I know servcies can be used with JOBS using DBMS_SCHEDULER but i wat ot know besides jobs what are all the things we can used with services.Yeah.That's right.
But in my case mwe are having a ERP applicaiton that has been build on oracle forms, so here we are having aeprate forms.Lets suppose that one form name is MEMBER.
and i have also created on servcie using
srvctl add service -d DB -s MEM -r RAC1,RAC2 -a RAC3
now my question how do i integrate this MEMBER form to services i.e MEM.
Like we can use in case oj create scheduling jobs using dbms_scheduler, we are having one prameter job_class where er have to specify the name of the parameter
but in my case how do i integrate it.
I hope you understandb my question. -
How to use the default database service name on creating procedure for data
how to use the default database service name on creating procedure for datagaurd client failover ??? all oracle doc says create a new service as below and enable at DB startup. but our client is using/wanted database default service to connect from application on the datagaurd environment (rac to non rac setup).please help.
Db name is = prod.
exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'prod',network_name =>'prod',failover_method => 'BASIC',failover_type => 'SELECT',failover_retries => 180,failover_delay => 1);
says already the service available.
CREATE OR REPLACE TRIGGER manage_dgservice after startup on database DECLARE role
VARCHAR(30);BEGIN SELECT DATABASE_ROLE INTO role FROM V$DATABASE;
IF role = 'NO' THEN DBMS_SERVICE.START_SERVICE('prod');
END IF;
END;
says trigger created, but during a swithover still the service is listeneing on listener.
tns entry.
prod =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = YES)
(ADDRESS = (PROTOCOL = TCP)(HOST = prod1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = prod2)(PORT = 1521)) ---> primary db entry
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = proddr)(PORT = 1521)) --> DR DB entry
(CONNECT_DATA =
(SERVICE_NAME = prod)
thanks in advance.
Edited by: 854393 on Dec 29, 2012 11:52 AMHello;
So in the example below replace "ernie" with the alias you want the client to use.
I can show you how I do it :
First an entry need to be added to the client tnsnames.ora that uses a SERVICE_NAME instead of a SID.
ernie =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Primary.host)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = Standby.host)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ernie)
)Next the service 'ernie' needs to be created manually on the primary database.
BEGIN
DBMS_SERVICE.CREATE_SERVICE('ernie','ernie');
END;
/After creating the service needs to be manually started.
BEGIN
DBMS_SERVICE.START_SERVICE('ernie');
END;
/Several of the default parameters can now be set for 'ernie'.
BEGIN
DBMS_SERVICE.MODIFY_SERVICE
('ernie',
FAILOVER_METHOD => 'BASIC',
FAILOVER_TYPE => 'SELECT',
FAILOVER_RETRIES => 200,
FAILOVER_DELAY => 1);
END;
/Finally a database STARTUP trigger should be created to ensures that this service is only offered if the database is primary.
CREATE TRIGGER CHECK_ERNIE_START AFTER STARTUP ON DATABASE
DECLARE
V_ROLE VARCHAR(30);
BEGIN
SELECT DATABASE_ROLE INTO V_ROLE FROM V$DATABASE;
IF V_ROLE = 'PRIMARY' THEN
DBMS_SERVICE.START_SERVICE('ernie');
ELSE
DBMS_SERVICE.STOP_SERVICE('ernie');
END IF;
END;
/lsnrctl status - should show the new service.
When I do this the Database will still register with the listener. I don't give that to the clients. That one will still be available but nobody knows about it. Meanwhile "ernie" moves with the database role.
So in my example the default just hangs out in the background.
Best Regards
mseberg
Edited by: mseberg on Dec 29, 2012 3:51 PM -
Hi Experts,
I am looking for High Availability and Disaster Recovery architecture for my data layer i.e. Oracle Database 11g R2
We have two physical locations and the distance between two sites is around 20 miles.
Site 1:
We already implemented RAC setup with two node in site 1.
Site 2:
We are going to implement standalone database. (Not RAC)
My requirements:
1. Both databases at Site 1 & Site 2 should be replica of each other.
2. Both databases should be in sync always.
3. Site 1 is active and Site 2 is stand by.
4. Client applications on Site 1 & Site 2 should always talk to RAC database on Site1.
5.. If RAC at site 1 goes down completely, then ONLY client apps should connect to Site2 database without human intervention.
How can acheive my requirement ? I was doing some research & found two solutions. 1. Active Data Guard 2. Golden Gate.
Questions:
1. Do Data Guard and Golden Gate offers same features ?
2. Which products offers solutions to all my requirements or Do I need to use both ?
3. If Data Guard and Golden Gate are different from each other then What is the difference between them and what are the overlapping features among them ?
Thanks1. Do Data Guard and Golden Gate offers same features ?No, there's simple compare here :
http://www.oracle.com/technetwork/database/features/availability/dataguardgoldengate-096557.html
2. Which products offers solutions to all my requirements or Do I need to use both ?Data Guard will work and you don't need anything else. I cannot speak to Golden Gate.
3. If Data Guard and Golden Gate are different from each other then
What is the difference between them and what are the overlapping features among them ?Again this document :
http://www.oracle.com/technetwork/database/features/availability/dataguardgoldengate-096557.html
1. Both databases at Site 1 & Site 2 should be replica of each other.
Data Guard can do this.
2. Both databases should be in sync always.
Data Guard can do this.
3. Site 1 is active and Site 2 is stand by.
Data Guard can do this.
4. Client applications on Site 1 & Site 2 should always talk to RAC database on Site1.
You can set your tnsnames to handle this and more. Using DBMS_SERVICE you can create an alias
to handle this.
Ex.
ernie =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary.host)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = standby.host)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ernie)
)5. If RAC at site 1 goes down completely, then ONLY client apps should connect to Site2 database without human intervention.
You can set your tnsnames to handle this and more.
Best Regards
mseberg -
Maximum number of service in a database?
Somebody can tell me if there is a maximum number of service I can use in a database? Those services are create with dbms_service or "srvctl add service" or dbca. Those services are set in the database parameter SERVICE_NAME automatically by the Clusterware or manually if it is not a cluster database.
Thank,
GGI would tend to be suspicious just because 50 services is quite a lot. If you really have 50 distinct applications and you want to manage 50 different services, 50 different TNS aliases, etc. you certainly can. But most organizations aren't going to see a lot of benefit from having that many services and may end up spending a lot of time micro-managing things the system unnecessarily.
You would generally have separate services if you wanted to have different services on different nodes of the cluster (i.e. create a reporting service on a subset of the nodes of the cluster for reporting work so that doesn't get comingled with the OLTP workload on the other nodes). It would be rather hard to manage 50 services on the same cluster effectively-- you'd either have all 50 services spread across all the nodes, in which case there would be little benefit to having all those services, or you'd have something like 5 services on each of 10 nodes which would tend to result in poor load balancing (assuming the load profile of each application is rather variable) or lead to constant administrative "futzing" to improve load balancing.
Justin -
DB:11.2.0.3
OS:Linux 5
Hi we have created a service oem_repository in such a way that it will start on that database whose role is primary. It was working fine before. But recently when we switchover the database now the service is not getting failover to the new primary . Hence, the application is not able to start on the new primary side.
Please advise.If you created the service with dbms_service, you should do it with srvctl or add it with the same because dbms_service is deprecated for RAC and oracle restart single instances, if you did not do something which you were supposed to do, you will not get the thing which you are supposed to get.. role changes in data guard managed by broker automatically start services appropriate to the datbase role, also the service starts when ROLE matches the current role of database and management policy is set to automatic..what option did you choose for failover type -e ? failover method -m ? you dont need to write a trigger also, all you need to get the failover of clients to a new primary is 4 things
1) Fast database failover
2) Restarting services on new primary
3) make sure you are using broker for this feature
4) notifying clients that a failure has occured to break out of tcp timeout and redirect to new primary
Regards
Karan -
Monitoring failover - Data Guard Broker
Hi,
I work on a Oracle 10.2.0.4 database on Solaris 10. It is a 2 node RAC database with a physical standby configured.
I want to monitor (send a mail) to myself when failover occurs (which will be triggered by data guard broker ) , I think so I can monitor the failover using alert log (which normally does log the command when we initiate a failover) but I am not sure whether data guard broker also does the same( writes appropriate commands when a failover is triggered)
Is there any other way we can come to know when a failover occurs (we can query database_role from v$dataguard status) but I am looking for some trigger that will be fired instantaneously when a failover is initiated ?
Also is it possible to monitor the observer, whether it is up or not ?Hi,
you have several possiblities to do that. Easiest is to use predefined Grid Control Events for it. Or you may put a trigger on the event "after DB_ROLE_CHANGE on database".
Monitoring the observer can be done with dgmgrl like
connect sys/<pw>@<cd>;
show configuration verbose;That show you the presence and location of the observer.
I give you an example for the usage of the trigger that starts a service depending on the role of the database. You may customize it to send you an email.
begin
dbms_service.create_service('safe','safe');
end;
create trigger rollenwechsel after DB_ROLE_CHANGE on database
declare
vrole varchar(30);
begin
select database_role into vrole from v$database;
if vrole = 'PRIMARY' then
DBMS_SERVICE.START_SERVICE('safe');
else
DBMS_SERVICE.STOP_SERVICE('safe');
end if;
end;
/ -
Connect time failover fails with ORA-01033
Hi,
I have primary and standby databases configured. I want to configured connect time failover such that when there is role transistion. Clients can connect to DB with out changing anything in thier tns files.
Here is my configuration.
hosta primary
hostb standby
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL=TCP)(HOST=hosta)(PORT=1521))
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(ORACLE_HOME = /usr/oracle/product/11.2.0.3)
(SID_NAME = tstxx)
(SID_DESC =
(GLOBAL_DBNAME = test1)
(ORACLE_HOME = /usr/oracle/product/11.2.0.3)
(SID_NAME = tstxx)
listener.ora on standby similar expect changes in hostnames.
Tnsnames.ora client
ctf =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostb) (PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = hosta) (PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = test1)
Notice that I have place hostb address intenally first so that if failover/swichover happens. client connection will not error out
sqlplus test@ctfSQL*Plus: Release 9.0.1.0.1 - Production on Fri Jun 22 17:38
(c) Copyright 2001 Oracle Corporation. All rights reserved.
Enter password:
ERROR:
ORA-01033: ORACLE initialization or shutdown in progress
But when I change tnsnames such that hosta comes first then the connection works. as it should
any help is appreciated!!
Edited by: user8927749 on Jun 22, 2012 2:58 PMHello;
I would review this document :
http://uhesse.com/2009/08/19/connect-time-failover-transparent-application-failover-for-data-guard/
The ORA-1033 hints you are trying to connect to the database in the wrong role. There's a trigger and some additional work which can prevent this.
Uwe's document should explain all.
The "SQL*Plus: Release 9.0.1.0.1 - Production on Fri Jun 22 17:38" is very odd. I would expect you would being using the client on the server is this not the case?
DBMS_SERVICE lets you define something like this :
ernie =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = primary.server)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = standby.server)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ernie)
Check out "CREATE_SERVICE Procedure" here :
http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_serv.htm
Best Regards
mseberg
Edited by: mseberg on Jun 22, 2012 5:42 PM
Maybe you are looking for
-
Windows 7 x64 bit and iTunes not recognizing iPhone 3GS
Hello, I'm sorry to bring this up again and I know the community has seen it a million times but I'm definately needing someone to point me in the right direction. I have an Acer 5552 Laptop with Windows 7 x64 bit. It does not have the Intel P55 chip
-
SRM SERVER 5.0: which is the max length possible for attachment ?
When I add file to a Shopping Cart in "Documents and Attachments" area , which is the maximum size permitted ? 1MB, 2MB, 3 MB? Thank you in advance. Best regards. Claudia.
-
LRT224 WAN IP Release and Renew
I am trying to debug an issue where my internet performance drops to nothing after about 18 hours of operation. I have bypassed the LRT224 for several hours and my cable modem seems fine. So now I am focused on the LRT224. When I log into the router
-
Set custom generated password during create user and email to user
Hi, In OIM 11g r2, I want to generate password using some logic and send a notification to the user with the generated password during user creation. Please let me know how to achive that.. can I use some post process event handler?? if yes then how
-
How do know that the battery is fully charged on ios 7
How do know that the battery is fully charged on ios 7