Oracle Client Service Name Configuration __oracle

Source: Internet
Author: User
Tags sqlplus

The Client service name establishes a connection to a remote or local listener that the client uses to issue a connection request to the server side.
When Oracle is installed, the user must specify a global database name, a SID name. Oracle automatically creates a service name on the server side with the specified SID name. When a client creates a service name, it needs to specify the network protocol, the information associated with the protocol, and the SID name of the database. For the most common TCP/IP protocols, you need to specify the server hostname or IP address, listener port, and database SID. These configuration information is stored in the Tnsnames.ora file, which is the same as the Listener.ora save location, and is located in the Oracle_home/network/admin directory. You can also configure using the start-Program-oracle-orahome92-configuration and Migration tools-net Configuration Assistant Wizard interface. Here the manual configuration process is mainly seen.
The files in the Tnsname.ora file that are primarily required to be configured are as follows:
Testservice =
(DESCRIPTION =
(Address_list =
(address = (PROTOCOL = TCP) (HOST = 192.168.5.1) (PORT = 1521))
)
(Connect_data =
(service_name = chstone)
)
)
One of our items, the first is "Testservice", which is the client-configured service name, the name can be arbitrarily taken, but it must be remembered, the front can not have a space. (address = (PROTOCOL = tcp) (HOST = 192.168.5.1) (PORT = 1521)), "PROTOCOL" represents the protocol type, which is TCP, and "host" is the server-side IP address or host name; Prot "is the port number. The following "Service_Name" represents the server-side service name. Because the SID name specified when I installed it is called "Chstone", Oracle automatically creates a default service name "Chstone" on the server side with the specified SID name. When using Sql*plus login to connect to the server side, the host string is populated with the client Net service name "Testservice" that is configured, and the host string may not be filled in if the computer is a server.

1.6 Using the Sql*plus query tool to connect to Oracle databases
Before connecting to the database server, start two Oracle-related services in the Windows Control Panel-management tools-services. That is: Oracleorahome92tnslistener (listener Service) and Oracleservicechstone (instance service), if the local server, and do not accept the remote client login, you can only open one of the following instance service.
Establish connection: Start-Program-oracle-orahome92-application development-sql Plus, the Login dialog box appears, enter the username and password, the host string is the previously configured NET service name, if empty, Indicates that the default database is connected to the local computer.
Use Start-to run the method of establishing a connection:
Directly enter the "Sqlplus" into the state of the Sql*plus, enter the "SQLPLUSW" into the WinDOS state sql*plus; You can enter the user name password directly in the following login, such as "SQLPLUSW Scott/tiger" If you want to log on to a remote server, then add the host string followed by the @ and password separated from the host string, for example: To log on to the remote server, the net service name we configured above is: "SQLPLUSW scott/tiger@testservice".
The $ symbol is used to execute DOS commands under Sql*plus, such as starting and shutting down services:
$ net start Oracleservicechstone (start service)
$ net stop Oracleservicechstone (off service)

Some common commands and use techniques in 1.7 sql*plus
Sql> Show user, which is a better way to display current users (dedicated in the Sql*plus tool), is to use the Sql> Select User from dual statement to view the current user, where the dual table is each sql* Plus users can use the Oracle table, what's really important here is to know that it contains only one row of data. );
Sql> set Pagelize 20; Sets the number of rows per page to 20;
sql> set linesize 100; Sets the number of characters displayed per line to 100; (You can save two statements in a c:/oracle/ora92/sqlplus/admin/if you don't want to set up a problem each time) In Glogin.sql, Oracle automatically runs the Glogin.sql file each time it is started, which is equivalent to initialization.
Sql> all; View the current environment settings;
Sql> spool file_name; outputs the displayed content to the specified file, such as Spool c:/spool.txt;
Sql> spool off; turn off the spool output, and only close the spool output to see the output in the output file;
Sql>/; rerun last command;
Sql> Set Timing On/off displays and closes the execution time spent on each SQL statement;
Sql> select * from tab; View all tables under current user;
sql> start file_name or sql> @ file_name execute a SQL script file, we can save multiple SQL statements in a text file, so that when you want to execute all the SQL statements in this file, use any of the above commands, This is similar to the batch processing in DOS;
sql> DESC table_name; Display the structure of the table;
Quick copy and paste techniques in Sql*plus (excerpt from www.cnoug.org):
1 mouse move to the beginning of the content you want to copy
2) with the right index finger press the left mouse button
3 Drag the mouse to the other corner of the content you want to copy, as you would for the selection in Word
4 after the selection of content (all the selection is reversed), the left mouse button press and hold the right mouse button
5 at this point, the selection is automatically copied to the last line of the Sql*plus environment

1.8 Super User password forgot to handle the way
1, in the beginning of the operation of the input Sqlplusw/nolog landing, that is not to start the service landing.
2. Start two services with $ net start Oracleservicechstone and $ net start Oracleorahome92tnslistener.
3, as a super user identity to connect the database sql> connect/as sysdba;
4, modify system password:sql> alter user system identified by "password".

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.