Oracle RAC services

Source: Internet
Author: User
Tags failover taf

The application workload can be defined as services in Oracle 10 Gb, also known as services. It can be used in a single instance or separately used and managed in RAC. Therefore, the entire database load can be divided into multiple different services. The management service can simplify the management of users or sessions. Second, the importance of services is reflected in RAC for load balancing and failover. This article describes what services are, the benefits of using services, and how to use services.

 

1. Services and SERVICE_NAME
Services
For client applications, you only need to care about the services provided by the database, without knowing which database or instance it is connected.
Therefore, we can create one or more services on the database server for use by clients. It is a general term for one or more service_names.
For these services, Oracle registers them to the listener for external connection.
You can use LSNRCTL status [listener_name] to view how many instances under the current service respond to the service.
You can also use LSNRCTL service [listener_name] to view more detailed information, including the current connection status, IP address, and port number.

SERVICE_NAME
The service name that the client connects to the instance. In Oracle 8i, the concept of SERVICE_NAME is proposed, which is usually used to replace oracle_sid in tnsnames. ora.
After 9i, we recommend that you use SERVICE_NAME instead of SID in Oracle.
Different user connections can be distinguished by defining different service names. The default format of this parameter is db_name.domain_name.
The following is the tnsnames. ora of a client. Two different connection identifiers use oracle_sid and one uses SERVICE_NAME. Both methods are feasible.
Sybo2sz_sid =
(Description =
(Address =
(Protocol = TCP)
(Host = 192.168.7.2)
(Port = 1915)
)
(CONNECT_DATA =
(Oracle_sid = sybo2sz) # oracle_sid = <> or SID = <>
)
)

Sybo2sz =
(Description =
(Address =
(Protocol = TCP)
(Host = 192.168.7.2)
(Port = 1915)
)
(CONNECT_DATA =
(SERVICE_NAME = sybo2sz) # SERVICE_NAME is recommended after Oracle 9i
)
)

Ii. Benefits of using services
As mentioned above, you can create multiple services for the same database to provide services for different client groups. For a single instance, although multiple services can be created for it, providing these services is always a single database single instance, so the performance is not obvious. In the case of multiple instances, different services can be distributed to different instances at different time periods or according to different business logic rules, and the preferred instances can be set for services, backup instance. Once a single point of failure occurs for the preferred instance, services will automatically fail to the backup instance.

Assume that the current RAC database has three nodes: srv1, srv2, and srv3.
There are two different services: sales.2gotrade.com and settlement.2gotrade.com run in the current database.
Then, the Sales Department uses the sales.2gotrade.com service name to establish a connection, and the Settlement Department uses the settlement.2gotrade.com service name to establish a connection.
The sales load is usually run on srv1 and srv2, and the corresponding slave node is srv3, that is, when the srv1 and srv2 nodes fail, all sales-based connections and loads will be transferred to node srv3.
Assume that the server load of the settlement department is usually small. Therefore, if the preferred node is srv3 and the slave node is srv1, after the srv3 node is spof, all the connections and loads of the settlement department will be transferred to srv1.
You do not need to worry about which database is connected to the instance on the node.

As described above
The connection between nodes is transparent to the client. You do not need to worry about the connected database or instance, and complicated background configurations are removed.
In RAC, multiple services can be centrally managed by clusters (dbca and srvctl) to simplify management costs.

 

3. Add or modify services
You can use dbca, srvctl, and OEM to create or manage services. When creating services, you can specify the preferred instance, backup instance, TFA, and other related options.
The following describes how to use the srvctl command to create and manage services.
1. Create services
Srvctl add service-D <db_name>-S <SERVICE_NAME>-R "preferred-instance-list"-a "available-instance-list"-P <TFA-Policy>
The TFA-policy option is basic or preconnect.
2. View service configurations
Srvctl config service-D <db_name> [-s SERVICE_NAME] [-A]

3. Configure services to run automatically
Srvctl enable | disable service-D <db_name>-s SERVICE_NAME-I instance_name

4. Start services
Srvctl start service-D <db_name>-S <SERVICE_NAME>-I instance_name-o start-Option-C connect-string-Q

5. Stop services
Srvctl stop service-D <db_name>-S <SERVICE_NAME>-I instance_name-C connect-string-Q-F

6. View service status
Srvctl Status Service-D <db_name>-S <SERVICE_NAME>-F-V

7. reprint services
Srvctl relocate service-D <db_name>-S <SERVICE_NAME>-I old_instance_name-T new_instance_name

8. delete services
Srvctl remove service-D <db_name>-S <SERVICE_NAME>-I instance_name [-F]
For details about how to use srvctl, enter srvctl at the prompt to obtain the Command help information.

 

4. Demonstration of srvctl creation and management services

1. Configure sys @ sybo2sz> show parameter service_names on a single instance; Name type value =----------- configure service_names stringsys @ sybo2sz> alter system set service_names = 'hr .sybo2sz.com, done '; system altered. sys @ sybo2sz> show parameter servicename type value ------------------------------------ ----------- ------------------------------ Servic E_names string hr.sybo2sz.com, sales. sybo2sz. c omoracle @ szdb:/u02/database/sybo2sz> LSNRCTL status listener_sybo2szlistener parameter file/users/Oracle/orahome10g/Network/admin/listener. oralistener log file/users/Oracle/orahome10g/Network/log/listener_sybo2sz.loglistening endpoints summary ........... service "hr.sybo2sz.com" has 1 instance (s ). -- # You can see that the listener already has the service instance "sybo2 for hr.sybo2sz.com SZ ", status ready, has 1 handler (s) for this service... service "sales.sybo2sz.com" has 1 instance (s ). instance "sybo2sz", status ready, has 1 handler (s) for this service ........... author: robinsonblog: Login (description = (address = (Protocol = TCP) (host = 192.168.7.2) (Port = 1915) (connect_dat A = (SERVICE_NAME = hr.sybo2sz.com) sales = (description = (address = (Protocol = TCP) (host = 192.168.7.2) (Port = 1915 )) (CONNECT_DATA = (SERVICE_NAME = sales.sybo2sz.com) c: \ Users \ Robinson. cheng> sqlplus Scott/tiger @ hrconnected to: Oracle Database 10g Release 10.2.0.3.0-64bit productionsql> show parameter servicename type value = -------------------------------------------------------------------------- --- Service_names string hr.sybo2sz.com, sales. sybo2sz. c om 2. Configure services in the cluster. Oracle @ bo2dbp: ~>. /Crs_stat.sh Resource Name target State -------------- ------ ----- ora. bo2dbp. asm1.asm online on bo2dbp ora. bo2dbp. listener_bo2dbp.lsnr online on bo2dbp ora. bo2dbp. GSD online on bo2dbp ora. bo2dbp. ONS online on bo2dbp ora. bo2dbp. VIP online on bo2dbp ora. bo2dbs. asm2.asm online on bo2dbs ora. bo2dbs. listener_bo2dbs.lsnr online on bo2dbs ora. bo2dbs. GSD Online online on bo2dbs ora. bo2dbs. ONS online on bo2dbs ora. bo2dbs. VIP online on bo2dbs ora. ora10g. DB online on bo2dbs ora. ora10g. ora10g1. inst online on bo2dbp ora. ora10g. ora10g2. inst online on bo2dbsoracle @ bo2dbp: ~> Export oracle_sid = ora10g1oracle @ bo2dbp: ~> Sqlplus/As sysdbasql> show parameter servicename type value ------------------------------------------- ---------------------------- service_names string ora10gsql> hostoracle @ bo2dbp: ~> Srvctl add service-D ora10g-s hr_ora10g-r ora10g1-A ora10g2-P basicoracle @ bo2dbp: ~>. /Crs_stat.sh Resource Name target State -------------- ------ ----- ora. bo2dbp. asm1.asm online on bo2dbp ora. bo2dbp. listener_bo2dbp.lsnr online on bo2dbp ora. bo2dbp. GSD online on bo2dbp ora. bo2dbp. ONS online on bo2dbp ora. bo2dbp. VIP online on bo2dbp ora. bo2dbs. asm2.asm online on bo2dbs ora. bo2dbs. listener_bo2dbs.lsnr online on bo2dbs ora. bo2dbs. GSD Online online on bo2dbs ora. bo2dbs. ONS online on bo2dbs ora. bo2dbs. VIP online on bo2dbs ora. ora10g. DB online on bo2dbs ora. ora10g. hr_ora10g.cs offline -- # the service has been added but is in the offline status ora. ora10g. hr_ora10g.ora10g1.srv offline ora. ora10g. ora10g1. inst online on bo2dbp ora. ora10g. ora10g2. inst online on bo2dbsoracle @ bo2dbp: ~> Srvctl config service-D ora10g-s hr_ora10g-A -- # view servicehr_ora10g Pref: ora10g1 avail: ora10g2 TAF: basicoracle @ bo2dbp: ~> Srvctl enable service-D ora10g-s hr_ora10g -- # enable self-starting serviceoracle @ bo2dbp: ~> Srvctl start service-D ora10g-s hr_ora10g -- # Start serviceoracle @ bo2dbp: ~>. /Crs_stat.sh Resource Name target State -------------- ------ ----- ora. bo2dbp. asm1.asm online on bo2dbp ora. bo2dbp. listener_bo2dbp.lsnr online on bo2dbp ora. bo2dbp. GSD online on bo2dbp ora. bo2dbp. ONS online on bo2dbp ora. bo2dbp. VIP online on bo2dbp ora. bo2dbs. asm2.asm online on bo2dbs ora. bo2dbs. listener_bo2dbs.lsnr online on bo2dbs ora. bo2dbs. GSD Online online on bo2dbs ora. bo2dbs. ONS online on bo2dbs ora. bo2dbs. VIP online on bo2dbs ora. ora10g. DB online on bo2dbs ora. ora10g. hr_ora10g.cs online on bo2dbp ora. ora10g. hr_ora10g.ora10g1.srv online on bo2dbp -- # service has been started ora. ora10g. ora10g1. inst online on bo2dbp ora. ora10g. ora10g2. inst online on bo2dbs Oracle @ bo2dbp: ~> Exitexitsql> show parameter service -- # The hr_ora10g service name type value contains ----------- invalid service_names string ora10g, hr_ora10goracle @ bo2dbp: ~> LSNRCTL status listener_bo2dbp -- # correspondingly, the listener also has the corresponding service ......... -- # note that the standby instance is not registered with the current serviceservice "hr_ora10g" has 1 instance (s ). instance "ora10g1", status ready, has 2 handler (s) for this service... service "ora10g" has 2 instance (s ). instance "ora10g1", status ready, has 2 handler (s) for this service... instance "ora10g2", status ready, has 1 handler (s) for this service ............. modify TAF configuration SQL> select name, failover_method, failover_type, goal, clb_goal from dba_services 2 where name = 'hr _ ora10g '; name failover_method failover_type goal clb_g contains invalid values ------------ too long use the modify_service package to update information in data dictionary and listener values (SERVICE_NAME => 'hr _ ora10g', failover_method => callback, failover_type => latency, latency => 180, latency => 5); end;/view again failover_method. The equivalent of failover_type has been displayed. SQL> select name, failover_method, failover_type, goal, clb_goal from dba_services 2 where name = 'hr _ ora10g'; Name failover_method failover_type goal clb_g when removing services using srvctl ---------- ----- hr_ora10g basic select long after removing services using srvctl, the preceding information can still be found in the view. You need to remove it using dbms_service.delete_service (SERVICE_NAME in varchar2;

V. Summary
1. A single instance enables the services feature by modifying the SERVICE_NAME parameter and tnsnames. ora.
2. One or more service_names can be specified, and up to 64 services can be created. Two hidden services can be removed and 62 services can be added. The total length is 4 K.
3. When dbca is used, services will be configured, and OCR will be automatically updated and services will be started. when services are deleted, services will also be automatically stopped and removed from OCR.
4. The srvctl tool only updates OCR. You need to use the dbms_service package to update the information in data dictionary and listener.
5. Configure services to achieve Load Balancing Based on business logic, which distributes different service requests to specific instances.
6. configuring services can also implement failover. You can specify the failover mode (basic, preconnect) and type (select, session) by setting the TAF option)
7. Services are integrated into clusters. You can use srvctl, dbca, OEM, and other tools for centralized management, such as self-starting and re-allocating services.
8. Oracle jobs can be distributed to different instances through services.

 

6. More references:
 

For more information about the basics and concepts of Oracle network configuration, see:

Services in Oracle Database 10g

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.