11g文件學習----sql連線
Connecting to the Database with SQL*Plus
Submit the SQL*Plus CONNECT Statement
You submit the SQL*Plus CONNECT statement to initially connect to the Oracle instance or at any time to reconnect as a different user. The syntax of the CONNECT statement is as follows:
CONN[ECT] [logon] [AS {SYSOPER | SYSDBA}]
The syntax of logon is as follows:
{username | /}[@connect_identifier] [edition={edition_name | DATABASE_DEFAULT}]
When you provide username, SQL*Plus prompts for a password. The password is not echoed as you type it.
The following table describes the syntax components of the CONNECT statement.
Syntax Component | Description |
---|---|
/ | Calls for external authentication of the connection request. A database password is not used in this type of authentication. The most common form of external authentication is operating system authentication, where the database user is authenticated by having logged in to the host operating system with a certain host user account. External authentication can also be performed with an Oracle wallet or by a network service. See Oracle Database Security Guide for more information. See also . |
AS {SYSOPER | SYSDBA} | Indicates that the database user is connecting with either the SYSOPER or SYSDBA system privilege. Only certain predefined administrative users or users who have been added to the password file may connect with these privileges. See for more information. |
username | A valid database user name. The database authenticates the connection request by matching username against the data dictionary and prompting for a user password. |
connect_identifier (1) |
An Oracle Net connect
identifier, for a remote connection. The exact syntax depends on the
Oracle Net configuration. If omitted, SQL*Plus attempts connection to a
local instance.
A common connect identifier is a net service name. This is an alias for an Oracle Net connect descriptor (network address and database service name). The alias is typically resolved in the tnsnames.ora file on the local computer, but can be resolved in other ways. See for more information on connect identifiers. |
connect_identifier (2) |
As an alternative, a connect identifier can use easy connect syntax. Easy connect provides out-of-the-box TCP/IP connectivity for
remote databases without having to configure Oracle Net Services on the
client (local) computer.
Easy connect syntax for the connect identifier is as follows (the enclosing double-quotes must be included): "host[:port][/service_name][:server][/instance_name]" where:
See for more information on easy connect. |
edition={edition_name | DATABASE_DEFAULT} |
Specifies the edition in which the new database session starts. If you specify an edition, it must exist and you must have the USE privilege on it. If this clause is not specified, the database default edition is used for the session.
See for information on editions and edition-based redefinition. |
Example 1-3
This simple example connects to a local database as user SYSTEM. SQL*Plus prompts for the SYSTEM user password.
connect system
Example 1-4
This example connects to a local database as user SYS with the SYSDBA privilege. SQL*Plus prompts for the SYS user password.
connect sys as sysdba
When connecting as user SYS, you must connect AS SYSDBA.
Example 1-5
This example connects locally with the SYSDBA privilege with operating system authentication.
connect / as sysdba
Example 1-6
This example uses easy connect syntax to connect as user salesadmin to a remote database running on the host dbhost.example.com. The Oracle Net listener (the listener) is listening on the default port (1521). The database service is sales.example.com. SQL*Plus prompts for the salesadmin user password.
connect salesadmin@"dbhost.example.com/sales.example.com"
, except that the service handler type is indicated.
connect salesadmin@"dbhost.example.com/sales.example.com:dedicated"
Example 1-8
This example is identical to , except that the listener is listening on the nondefault port number 1522.
connect salesadmin@"dbhost.example.com:1522/sales.example.com"
Example 1-9
This example is identical to , except that the host IP address is substituted for the host name.
connect salesadmin@"192.0.2.5/sales.example.com"
Example 1-10
This example connects using an IPv6 address. Note the enclosing square brackets.
connect salesadmin@"[2001:0DB8:0:0::200C:417A]/sales.example.com"
Example 1-11
This example specifies the instance to which to connect and omits the database service name. A default database service must have been specified, otherwise an error is generated. Note that when you specify the instance only, you cannot specify the service handler type.
connect salesadmin@"dbhost.example.com//orcl"
Example 1-12
This example connects remotely as user salesadmin to the database service designated by the net service name sales1. SQL*Plus prompts for the salesadmin user password.
connect salesadmin@sales1
Example 1-13
This example connects remotely with external authentication to the database service designated by the net service name sales1.
connect /@sales1
Example 1-14
This example connects remotely with the SYSDBA privilege and with external authentication to the database service designated by the net service name sales1.
connect /@sales1 as sysdba
Example 1-15
This example connects remotely as user salesadmin to the database service designated by the net service name sales1. The database session starts in the rev21 edition. SQL*Plus prompts for the salesadmin user password.
connect salesadmin@sales1 edition=rev21
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29519108/viewspace-1423032/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- go 連線資料庫 - GORM學習 - sql查詢Go資料庫ORMSQL
- 【學習】SQL基礎-006-多表連線查詢SQL
- sql 內連線和外連線SQL
- HikariCP連線池的學習
- MySQL學習-連線查詢MySql
- SQL連線查詢SQL
- Oracle官網文件學習路線導圖Oracle
- spring官網線上學習文件翻譯Spring
- 最近學習了Http連線池HTTP
- docker學習5:Docker 容器連線Docker
- python 怎麼連線 sql server,不是連線 mysqlPythonServerMySql
- MYSQL學習筆記23: 多表查詢(自連線內連線+左右外連線)MySql筆記
- Golang SQL連線池梳理GolangSQL
- SQL的連線型別SQL型別
- Oracle 11G 安裝文件Oracle
- SQL 改寫系列十:半連線轉內連線SQL
- SQL 資料庫學習路線推薦SQL資料庫
- OceanBase學習之路3 |SpringJDBC 連線示例SpringJDBC
- OceanBase學習之路4|SpringBoot 連線示例Spring Boot
- OceanBase學習之路9|連線方式概述
- substrate學習筆記13:連線parachain筆記AI
- 近期學習文件
- SQL學習SQL
- SQL 學習SQL
- NavicatPremium 連線SQL Server 、MySQL等REMServerMySql
- 推薦幾個SQL線上學習網站SQL學習網站
- C學習--自定義字串連線函式字串函式
- 資料庫學習(四)連線查詢資料庫
- SQL Server如何判斷哪些會話/連線是長連線?SQLServer會話
- SQL語言基礎(多表連線)SQL
- Windows 下 Laravel 7.0 連線 sql serverWindowsLaravelSQLServer
- SQL中的四種連線方式SQL
- 使用11g客戶端或pl/sql developer連線高版本Oracle 19c ORA-28040 ORA-01017客戶端SQLDeveloperOracle
- sql 連線查詢例項(left join)三表連線查詢SQL
- 【SQL】SQL表連線方法方式介紹(Oracle/Postgresql)SQLOracle
- 全連線神經網路學習筆記神經網路筆記
- python基礎學習24—-使用pymysql連線mysqlPythonMySql
- [20201116]11g連線謂詞推入push_pred問題.txt
- 面向官方文件學習Pytoch