您的位置:首页 > 数据库 > Oracle

Linux下Oracle的基本操作

2011-09-07 19:45 471 查看
1.启动数据库监听

su - oracle :切换到ORacle用户(如果使用su oracle,则启动时不运行.profile用户环境配置文件)

$lsnrctl start 启动监听的命令

2.启动数据库命令:

$sqlplus “/ as sysdba” 用sys用户登录sqlplus

SQL*Plus: Release 9.2.0.5.0- Production on Thu Oct 9 15:06:11 2003

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to an idle instance.

SQL> startup——启动数据库

ORACLE instance started.

Total System Global Area 538412728 bytes

Fixed Size 743096 bytes

Variable Size 268435456 bytes

Database Buffers 268435456 bytes

Redo Buffers 798720 bytes

Database mounted.

Database opened.

SQL> exit——退出sqlplus

Disconnected from Oracle9i EnterpriseEdition Release 9.2.0.5.0 - 64bit Production

With the Partitioning option

JServer Release 9.2.0.5.0 -Production

或者

$dbstart

如果执行dbstart 出现Failed to auto-start Oracle Net Listene using /ade/vikrkuma_new/oracle/bin/tnslsnr 错误,我们需要先到oracle的安装目录下的bin目录下找到dbstart文件 通过vi dbstart.找到 给 ORACLE_HOME_LISTNER 变量赋值的地方 比如 ORACLE_HOME_LISTNER=/ade/vikrkuma_new/oracle。 把这个给注释了(shell编程注释是在前面加个#号),在修改成
export ORACLE_HOME_LISTNER=$ORACLE_HOME,保存退出,在执行dbstart就行了。

3.关闭数据库

$sqlplus “/ as sysdba”

SQL*Plus: Release 9.2.0.5.0- Production on Thu Oct 9 15:07:04 2003

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.5.0- 64bit Production

With the Partitioning option

JServer Release 9.2.0.5.0 -Production

SQL> shutdown immediate——关闭数据库

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> exit

Disconnected from Oracle9i EnterpriseEdition Release 9.2.0.5.0 - 64bit Production

With the Partitioning option

JServer Release 9.2.0.5.0 -Production

或者

$dbshut

4 停止数据库监听

$ lsnrctl stop --停止监听

5.查询oracle相关的进程

ps -ef|grep oracle

6.查询Oracle的监听

ps -ef|grep lsnr.

注意(有时候突然连接不上oracle,首先是查看oracle的监听是否突然断了或者突然在服务器上起了两个,突然断了只要到oracle用户下执行lsnrctl start 启动监听就行,如果突然启动了两个,只要杀掉其中一个就行)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: