11g文档学习----sql连接

news/2024/10/18 2:30:05/
11 g Release 2 (11.2)》Supporting Documentation》Administrator's Guide》 1 Getting Started with Database Administration

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 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:

host is the host name or IP address of the computer hosting the remote database.

Both IP version 4 (IPv4) and IP version 6 (IPv6) addresses are supported. IPv6 addresses must be enclosed in square brackets. See for information about IPv6 addressing.

port is the TCP port on which the Oracle Net listener on host listens for database connections. If omitted, 1521 is assumed.

service_name is the database service name to which to connect. Can be omitted if the Net Services listener configuration on the remote host designates a default service. If no default service is configured, service_name must be supplied. Each database typically offers a standard service with a name equal to the global database name, which is made up of the DB_NAME and DB_DOMAIN initialization parameters as follows:

DB_NAME.DB_DOMAIN

If DB_DOMAIN is null, then the standard service name is just the DB_NAME. For example, if DB_NAME is orcl and DB_DOMAIN is us.example.com, then the standard service name is orcl.us.example.com.

See for more information.

server is the type of service handler. Acceptable values are dedicated, shared, and pooled. If omitted, the default type of server is chosen by the listener: shared server if configured, otherwise dedicated server.

instance_name is the instance to which to connect. You can specify both service name and instance name, which you would typically do only for Oracle Real Application Clusters (Oracle RAC) environments. For Oracle RAC or single instance environments, if you specify only instance name, you connect to the default database service. If there is no default service configured in the listener.ora file, an error is generated.You can obtain the instance name from the instance_name initialization parameter.

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"

Example 1-7

This example is identical to Example 1-6, 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 Example 1-6, 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 Example 1-6, 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/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29519108/viewspace-1423032/


http://www.ppmy.cn/news/157623.html

相关文章

11g导出报错:EXP-00106: Invalid Database Link Passwords

11g导出报错:EXP-00106: Invalid Database Link Passwords 服务器端:11.2.0.4.0 ; 导出客户端:11.2.0.2 报错提示: About to export the entire database ... . exporting tablespace definitions . exporting profile…

OCR文字识别方法综述

👨‍💻作者简介:大数据专业硕士在读,CSDN人工智能领域博客专家,阿里云专家博主,专注大数据与人工智能知识分享,公众号:GoAI的学习小屋,免费分享书籍、简历、导图等资料,更有交流群分享AI和大数据,加群方式公众号回复“加群”或➡️点击链接。 🎉专栏推荐:➡️点…

bzoj 4743: [Usaco2016 Dec]Robotic Cow Herd 线段树+二分答案

题意 有n个数集&#xff0c;每个数集里最多只有10个元素&#xff0c;现在从每个数集里面选数一个数&#xff0c;假设选出的数的和是p&#xff0c;给出k&#xff0c;问前k小的p的和。 n,k<100000 分析 首先二分答案lim&#xff0c;然后考虑如何找到所有不大于lim的p的和。…

11g文档学习----sysdba sysoper OSDBA OSOPER

11 g Release 2 (11.2)》Supporting Documentation》Administrators Guide》 1 Getting Started with Database Administration SYSDBA and SYSOPER The following operations are authorized by the SYSDBA and SYSOPER system privileges: System Privilege Operations Au…

11G GI 安装同时跑脚本测试

问题&#xff1a;11G执行第二个脚本时间较长&#xff0c;测试两机器同时跑脚本 测试结果&#xff1a; 不能同时执行&#xff0c;必须依次执行&#xff0c;第二个脚本同时执行会因磁盘争夺导致失败&#xff1b; 第2个脚本先执行的节点&#xff0c;ASM SID将是第一个&#xff…

oracle杀掉pmon进程的影响,11g_测试kill杀死 background process后台进程与alert

----oracle后台进程 -bash-3.2$ ps -ef|grep ora_ oracle 4079 1 0 04:30 ? 00:00:05 ora_pmon_zxy oracle 4081 1 0 04:30 ? 00:00:03 ora_vktm_zxy oracle 4085 1 0 04:30 ? 00:00:01 ora_gen0_zxy oracle 4087 1 0…

ORACLE11G 性能调优学习

Oracle? Database 2 Day Performance Tuning Guide 11g Release 2 (11.2) E10822-04 重点需要掌握的工具 ADDM ASH ASSM Part I 一&#xff1a;调优工具 1、Oracle Database 11g Enterprise Edition 2、Oracle Enterprise Manager 3、Oracle Diagnostics Pack 4、Oracle Dia…

linux安装11g rac

&#xfeff;&#xfeff; 1、检查系统所需的软件包 rpm -qa | grep -E "binutils|compat-libstdc|elfutils-libelf|gcc|glibc|libaio|libgcc|libstdc|make|sysstat|unixODBC|pdksh" [roottestdb01 /]# rpm -qa | grep -E "binutils|compat-libstdc|elfutil…