oracle联机文档使用,Sqlplus 联机文档学习

Oracle联机文档

[原文]

Starting SQL*Plus Command-line

The SQL*Plus executable is usually installed in $ORACLE_HOME/bin, which is usually included in your operating system PATH environment variable. You may need to change directory to the $ORACLE_HOME/bin directory to start SQL*Plus.

In the following examples, you are prompted to enter the database account password.

An example using an Easy Connection identifier to connect to the HR schema in the MYDB database running on mymachine is:

sqlplus hr@\"//mymachine.mydomain:port/MYDB\"

An example using a Net Service Name is:

sqlplus hr@MYDB

Net Service Names can be stored in a number of places, including Oracle Names. See the Net Services Reference Guide for more information.

[译文]

启动Sqlplus命令行模式:

通常情况下,Sqlplus可以执行,它的安装目录是$ORACLE_HOME/bin,而且在系统中设置环境变量PATH,需要将目录改变为$ORACLE_HOME/bin,就可以执行Sqlplus。

下面的例子,按照提示,可以输入数据库的帐号和口令。

这个例子在我们的机器上运行简单的连接标识符来连接MYDB数据库的HR模式:

sqlplus hr@\"//mymachine.mydomain:port/MYDB\" 可以使用网络服务名称: sqlplus hr@MYDB 网络服务名称能存储一个确认点,包括Oracle数据库名。可以查看关于网络服务参考指导的更多信息。 [原文]

If you want to use Net Service Names configured in a local Oracle Net tnsnames.ora file, then set the environment variable TNS_ADMIN to the directory containing the tnsnames.ora file. For example, on UNIX, if your tnsnames.ora file is in /home/user1 and it defines the Net Service Name MYDB2:

TNS_ADMIN=/home/user1 export TNS_ADMIN sqlplus hr@MYDB2

This example assumes the ORACLE_HOME environment variable is set, and the $ORACLE_HOME/network/admin/tnsnames.ora or ORACLE_HOME\network\admin\tnsnames.ora file defines the Net Service Name MYDB3:

sqlplus hr@MYDB3

The TWO_TASK (on UNIX) or LOCAL (on Windows) environment variable can be set to a connection identifier. This removes the need to explicitly enter the connection identifier whenever a connection is made in SQL*Plus or SQL*Plus Instant Client. This UNIX example connects to the database known as MYDB4:

TNS_ADMIN=/home/user1 export TNS_ADMIN TWO_TASK=MYDB4 export TWO_TASK sqlplus hr

[译文]

如果我们使用网络服务名称,那就需要配置Oracle的网络文件tnsnames.ora;设置tnsnames.ora文件中的TNS_ADMIN环境变量。例如下面例子,在UNIX下,如果你的tnsnamets.ora文件设置目录/home/user1,并且定义网络服务名称为MYDB2:

TNS_ADMIN=/home/user1

export TNS_ADMIN

sqlplus hr@MYDB2

这个例子指出ORACLE_HOME环境变量已经被设置,并且定义$ORACLE_HOME/network/admin/tnsnames.ora or ORACLE_HOME\network\admin\tnsnames.ora中的网络服务名称为MYDB3:

sqlplus hr@MYDB3

在Unix和Windows下设置环境变量为确认连接标识符。当我们通过Sqlplus连接Oracle数据库时,需要确认连接标识符,这个UNIX例子中,连接的数据库被命名为MYDB4:

TNS_ADMIN=/home/user1

export TNS_ADMIN

TWO_TASK=MYDB4

export TWO_TASK

sqlplus hr

[原文]

To start SQL*Plus and connect to the default database

Open a UNIX or a Windows terminal and enter the SQL*Plus command:

sqlplus

When prompted, enter your Oracle Database username and password. If you do not know your Oracle Database username and password, ask your Database Administrator.

Alternatively, enter the SQL*Plus command in the form:

sqlplus username

You are prompted to enter your password.

SQL*Plus starts and connects to the default database.

Now you can start entering and executing SQL, PL/SQL and SQL*Plus statements and commands at the SQL> prompt.

To start SQL*Plus and connect to a database other than the default

Open a UNIX or a Windows terminal and enter the SQL*Plus command:

sqlplus username@connect_identifier

You are prompted to enter your password.

[译文]

启动Sqlplus连接默认的数据库

1. 打开UNIX和Windows系统中的终端窗口,输入Sqlplus命令:

sqlplus

2. 当提示符出现,输入Oracle数据库的用户名和密码。如果不确定用户名和密码,请向数据库管理员询问。

3. 也可以在Sqlplus命令行提示符下输入命令:

sqlplus username

根据提示,输入密码。

4.Sqlplus启动后,连接到默认的数据库上。

现在就可以在Sqlplus提示符>下输入Sql,PL/SQL和Sqlplus命令了。

如何启动Sqlplus连接到其它默认的数据库:

sqlplus username@connect_identifier 然后根据提示输入密码即可。 [原文]

Starting SQL*Plus Instant Client

SQL*Plus Instant Client is the SQL*Plus command-line without the need to install Oracle Database. For information about using it, see Starting SQL*Plus Command-line.

Because SQL*Plus Instant Client does not include a database, it is always 'remote' from any database server. To connect to a database you must specify the database using an Oracle Net connection identifier.

If TNS_ADMIN is not set, then an operating system dependent set of directories is examined to find tnsnames.ora. This search path includes looking in the directory specified by the ORACLE_HOME environment variable for network/admin/tnsnames.ora. This is the only reason to set the ORACLE_HOME environment variable for SQL*Plus Instant Client. If ORACLE_HOME is set when running Instant Client applications, it must be set to a directory that exists.

[译文]

启动Sqlplus安装客户端

当Oracle数据库没有安装Sqlplus时,就需要安装Sqlplus安装客户端;

因为Sqlplus安装客户端不包含在数据库中,它通常是通过其它数据库“远程”连接。所以连接到一个数据库必须指定数据库的网络连接标识符。

当操作系统依靠设置、检查的tnsnames.ora没有设置TNS_ADMIN,这个搜索过程包括目录的ORACLE_HOMT环境变量中的network/admin/tnsnames.ora.这是对Sqlplus安装客户端唯一进行设置的ORACLE_HOME环境变量。所以,如果ORACLE_HOME在安装运行客户端应用程序的过程时是设置了,那么它必须被设置目录和存在。

[原文]

Connecting to a Different Database

From an existing command-line session, enter a CONNECT command in the form:

SQL> connect username@connect_identifier

You are prompted to enter your password.

[译文]

如何连接不同的数据库

从已经连接的会话中退出,然后键入“CONNECT命令:

SQL> connect username@connect_identifier 然后根据提示输入密码。

(待续……)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值