Applications used in the RAC environment sometimes want a specific application to only run on the child node of the RAC, or assign a primary node to some applications. In this regard, Oracle 10 Gb can be implemented using services.
I. cluster configuration
Before using services, check whether the cluster configuration is correct. The following command output the database orcl running on three different nodes. Srvctl config database-D orclserver01 orcl1/u01/APP/Oracle/product/10.1.0/db_1server02 orcl2/u01/APP/Oracle/product/10.1.0/db_1server03 orl3/u01/APP/Oracle/ product/10.1.0/db_1 are usually completed during database creation. You can also use the following command. Srvctl add database-D orcl-o/u01/APP/Oracle/product/10.1.0/db_1 # Add database orcl $ ORACLE_HOME to crssrvctl add instance-D orcl-I orcl1-N server01 # Add the corresponding instance to the database orcl to crssrvctl add instance-D orcl-I orcl2-N server02srvctl add instance-D orcl-I orl3-N server03
2. Create a service
You can use the srvctl command, dbca tool, and dbms_services package to create and modify services. This article only uses the srvctl command line. Assume that there are two applications that want to run in the following way: OLTP: mainly runs on node 1 and node 2, and can run on node 3 when Node 1 and node 2 are unavailable. Batch: It mainly runs on node 3. When Node 3 is unavailable, it can run on nodes 1 and 2. To meet the above requirements, we can create the following services # Set environment. export ORACLE_HOME =/u01/APP/Oracle/product/10.1.0/db_1export Path = $ ORACLE_HOME/bin: $ path # create services. srvctl add service-D orcl-s oltp_service-r orcl1, orcl2-A orcl3srvctl add service-D orcl-s batch_service-r orl3-A orcl1, orcl2oltp_service can run on all RAC nodes, because orl3 is in the available list, but generally runs on node 1 and node 2. (-R indicates an available node.) batch_service can run on all RAC nodes because orcl1 and orcl2 are in the available list. Generally, this service runs on node 3. (-R indicates available nodes) these services can stop srvctl start service-D orcl-s oltp_servicesrvctl start service-D orcl-s batch_servicesrvctl stop service-D orcl-s oltp_servicesrvctl stop service-D orcl -s batch_service
Iii. jobs and services
-- Oracle 10g sched allows links between jobs and job classes so that services-related jobs run on specified nodes in the RAC environment by job class. -- To meet the preceding requirements, you can create the following two job classes. -- Create OLTP and batch job classes. begin classes (job_class_name => 'oltp _ job_class ', service => 'oltp _ Service'); dbms_scheduler.create_job_class (job_class_name => 'batch _ job_class ', service => 'batch _ Service'); end;/-- make sure the relevant users have access to the job classes. grant execute on sys. oltp_job_class to my_user; grant execute on sys. batch_job_class to my_user; -- You can assign an existing job to a newly created job class or to this job class when creating a job -- create a job associated with a job class. begin dbms_scheduler.create_job (job_name => 'my _ User. oltp_job_test ', job_type => 'plsql _ Block', job_action => 'in in NULL; end;', start_date => paiimestamp, repeat_interval => 'freq = daily ;', job_class => 'sys. oltp_job_class ', end_date => null, enabled => true, comments => 'job linked to the oltp_job_class. '); End ;/-- The above job and job class is understood that the service can run on one or more specified nodes and available nodes, so you can create a job based on the service. -- Next, assign the job to the service-based job class so that the job can run on one or more specified nodes. -- Assign a job class to an existing job. Exec dbms_scheduler.set_attribute ('My _ batch_job ', 'job _ class', 'batch _ job_class'); -- Translator: Robinson -- Blog: http://blog.csdn.net/robinson_0612
Iv. Connections and services
The use of services is not limited by the use of jobs. The following services can be added to the tnsnames. ora file and list the nodes that each application can use. OLTP = (description = (load_balance = on) (Failover = on) (address = (Protocol = TCP) (host = server01) (Port = 1521 )) (address = (Protocol = TCP) (host = server02) (Port = 1521) (address = (Protocol = TCP) (host = server03) (Port = 1521 )) (CONNECT_DATA = (SERVICE_NAME = oltp_service) (failover_mode = (type = select) (method = Basic) (retries = 20) (delay = 1 )))) batch = (description = (load_balance = On) (Failover = on) (address = (Protocol = TCP) (host = server01) (Port = 1521) (address = (Protocol = TCP) (host = server02) (Port = 1521) (address = (Protocol = TCP) (host = server03) (Port = 1521) (CONNECT_DATA = (SERVICE_NAME = batch_service) (failover_mode = (type = select) (method = Basic) (retries = 20) (delay = 1) # The above provides the corresponding link identifier for the application, connect to the specified service with the corresponding connection identifier.
Original article: Services in Oracle Database 10g
V. More references
For more information about the basics and concepts of Oracle network configuration, see:
Configure the Oracle client to connect to the database
Configure dynamic service registration for non-default ports
Configure sqlnet. ora to restrict IP Access to Oracle
Configure and manage Oracle listener logs
Set the Oracle listener password (listener)
Oracle RAC Listener Configuration
Non-Default port listening configuration in Oracle RAC (listener. ora tnsnames. ora)
Load Balance)
Configure RAC load balancing and Failover
For more information about user-managed backup and recovery, see
Oracle cold backup
Oracle Hot Backup
Concept of Oracle backup recovery
Oracle instance recovery
Oracle recovery based on user management
System tablespace management and Backup Recovery
Sysaux tablespace management and recovery
Oracle backup control file recovery (unsing backup controlfile)
For information on RMAN backup recovery and management, see
RMAN overview and architecture
RMAN configuration, Monitoring and Management
Detailed description of RMAN backup
RMAN restoration and recovery
Create and use RMAN catalog
Create RMAN storage script based on catalog
Catalog-based RMAN backup and recovery
RMAN backup path confusion
For the Oracle architecture, see
Oracle tablespace and data files
Oracle Password File
Oracle parameter file
Oracle online redo log file)
Oracle Control File)
Oracle archiving logs
Oracle rollback and undo)
Oracle database instance startup and Shutdown Process
Automated Management of Oracle 10g SGA
Oracle instances and Oracle databases (Oracle Architecture)