1、Default logins are created and you are prompted for associated passwords during Oracle Database installation. Some of the default login usernames created are: SYS SYSTEM HRLogins are created and displayed in messages during Oracle Database installation.For further information about the default login
2、s, see the Oracle Database Administrators Guide.Once you have logged in, you can connect under a different username with the SQL*Plus CONNECT command. The username and password must be valid for the database. For example, to connect the username TODD to the default database using the password FOX, y
3、ou could enterCONNECT TODD/FOXIn the command-line interface, if you omit the username and password, SQL*Plus prompts you for them. You also have the option of typing only the username following CONNECT and omitting the password (SQL*Plus then prompts for the password). Because CONNECT first disconne
4、cts you from your current database, you will be left unconnected to any database if you use an invalid username and password in your CONNECT command.If you log on or connect as a user whose account has expired, you are prompted to change your password before you can connect.If an account is locked,
5、a message is displayed and connection as this user is not permitted until the account is unlocked by your DBA.You can use the DISCONNECT command to disconnect from a database without leaving SQL*Plus.Changing your PasswordIn the command-line interface, you can change your password with the PASSWORD
6、command. See PASSWORD.Changing Your Password in iSQL*PlusYou can change your Oracle Database account password in the Change Password screen. If you have logged in with DBA privileges, you can change the password of other users. You access the Change Password screen from the Preferences screen.Descri
7、ption of the illustration prefs_password.gifUsername:Enter your Oracle Database account username.Old password:Enter your current Oracle Database account password.New password:Enter your new password.Retype new password:Enter your new password again to make sure you have entered it correctly.ApplyCli
8、ck the Apply button to change the password for your Oracle Database account.CancelClick the Cancel button to clear the screen without changing your password.Expired PasswordIn the command-line interface, if your password has expired, SQL*Plus prompts you to change it when you attempt to log in. You
9、are logged in once you successfully change your password.Expired Password Screen in iSQL*PlusIf your password has expired, the Expired Password screen is automatically displayed when you attempt to log in. Fill out the fields on the Expired Password screen as you would for the Change Password screen
10、.You are logged in once you successfully change your password. If you click the Cancel button, you are returned to the Login screen.Description of the illustration password_expired.gifConnecting to a DatabaseYou must connect to an Oracle Database (instance) before you can query or modify data in tha
11、t database. You can connect to the default database and to other databases accessible through your network. To connect to another database over a network, both databases must have Oracle Net configured, and have compatible network drivers. You must enter either a connection identifier or a net servi
12、ce name to connect to a database other than the default.The connection identifier or net service name is entered: as an argument to the SQLPLUS Program Syntax when starting a command-line session. in the Connection Identifier field in the iSQL*Plus Login Screen when starting iSQL*Plus. in the Host S
13、tring field in the Log On dialog when Starting the Windows Graphical User Interface. as an argument to the CONNECT command from a current session.Net Service NameYour DBA is responsible for creating the databases you use and defining net service names for them in the tnsnames.ora file. In iSQL*Plus,
14、 your DBA can also restrict the databases available to those shown in a dropdown list of net service names.A net service name definition in the tnsnames.ora file has the syntax:net_service_name= (DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=port) )(CONNECT_DATA= (SERVICE_NAME=service_name) )
15、 ) To use a net service name (alias), it must have an entry in the tnsnames.ora file on the machine running SQL*Plus, or for iSQL*Plus, the machine running the iSQL*Plus Application Server. An entry in tnsnames.ora is not required if you use a connection identifier.Example 4-1 tnsnames.ora entry for
16、 the sales databaseSALES1 =(DESCRIPTION =(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521) )(CONNECT_DATA=(SERVICE_NAME=) ) )Example 4-2 Start a command-line session to the sales database using the net service nameSQLPLUS hr/passwordSALES1See the Oracle Net Services Reference Guide and the Oracl
17、e Net Services Administrators Guide for more information about database connections and net service name definitions.Full Connection IdentifierDepending on your configuration, use the full connection identifier syntax like:(DESCRIPTION=(SERVICE_NAME=service_name) ) )You can optionally use the (INSTA
18、NCE_NAME=instance) phrase in place of the (SERVICE_NAME=service_name) phrase.When connecting to an Oracle8i database, use the (SID=name) phrase in place of the (SERVICE_NAME=service_name) phrase.Example 4-3 Full connection identifier for SALES1SQLPLUS hr/password(DESCRIPTION=Easy Connection Identifi
19、erThe easy or abbreviated connection identifier has the syntax:/host:port/service_nameExample 4-4 Start a command-line session to the sales database using the easy connection identifiersqlplus hr/passwordsales-server:1521/Example 4-5 CONNECT to the sales database using the easy connection identifier
20、connect hr/passwordsales-server:The easy connection identifier can be used wherever you can use a full connection identifier, or a net service name. The easy syntax is less complex, and no tnsnames.ora entry is required.Connectionless Session with /NOLOGIn the command-line interface, it is possible
21、to start SQL*Plus without connecting to a database. This is useful for performing some database administration tasks, writing transportable scripts, or to use SQL*Plus editing commands to write or edit scripts.You use the /NOLOG argument to the SQLPLUS command to start a connectionless command-line
22、session. After SQL*Plus has started you can connect to a database with the CONNECT command.Example 4-6 Start a connectionless SQL*Plus session with /NOLOGSQLPLUS /NOLOG If you are connecting to a remote Oracle database, make sure your Oracle Net software is installed and working properly. For more i
23、nformation, see the Oracle Net Services AdministratorWhen you start a SQL*Plus command-line or Windows GUI session, and after a CONNECT command in that session, the site profile, glogin.sql, and the user profile file, login.sql, are processed: After SQL*Plus starts and connects, and prior to display
24、ing the first prompt. After SQL*Plus starts and connects, and prior to running a script specified on the command-line. Prior to the first prompt when /NOLOG is specified on the command-line and no connection is made.The site profile file, glogin.sql is processed first, then the user profile file, lo
25、gin.sql.When you start an iSQL*Plus session, and after a CONNECT command in that session, the site profile, glogin.sql, is processed: After iSQL*Plus starts and connects. After iSQL*Plus starts and connects, and prior to running a script specified in a dynamic URL.Behavior in SQL*Plus 10.1 may be un
26、expected depending on the setting of SET SQLPLUSCOMPATIBILITY. For example, processing glogin.sql and login.sql after a CONNECT command only occurs with the default SQLPLUSCOMPATIBILITY setting of 10.1. For more information, see SET SQLPLUSCOMPATIBILITY x.y.z.Starting Command-line SQL*PlusTo begin u
27、sing SQL*Plus, you must first understand how to start and stop SQL*Plus.Example 4-7 Starting SQL*PlusThis example shows you how to start SQL*Plus:1. Make sure that SQL*Plus has been installed on your computer.2. Log on to the operating system (if required).3. Enter the command, SQLPLUS, and press Re
28、turn.Note:Some operating systems expect you to enter commands in lowercase letters. If your system expects lowercase, enter the SQLPLUS command in lowercase.SQLPLUSSQL*Plus displays its version number, the current date, and copyright information, and prompts you for your username (the text displayed
29、 on your system may differ slightly):SQL*Plus: Release 10.1.0.2.0 - Production on Thu Oct 5 16:29:01 2003(c) Copyright 1982, 2003 Oracle Corporation. All rights reserved.Enter user-name:4. Enter your username and press Return. SQL*Plus displays the prompt Enter password:5. Enter your password and press Return again. For your protection, your password doe
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1