Linux ORACLE 基本操作

手动启动ORACLE: 

1.使用oracle帐户登陆
如果是su oracle,则需要执行source /home/oracle/.bash_profile
2.在终端窗口中输入如下命令
$lsnrctl start #这个命令是打开监听程序,开始监听
$emctl start dbconsole #这个命令是打开控制台,em也就是企业管理器的缩写,不执行这个命令,肯定是不能在浏览器中打开数据库主页的!注意:这个过程较长,要等待!
然后的步骤就是进入sqlplus,连接数据库实例了!
$sqlplus /nolog #我不知道这个命令的具体意思,但是这样作就可以的!
sql>conn system/manager as sysdba #这句的意思是使用system用户作为dba角色连接数据库,当然也可以用sys,sysman等用户来连接;
接下来就是打开数据库了!
sql>startup
然后是等待,如果想知道自己连接的实例名,控制台下执行ECHO $ORACLE_SID就知道了!
 也可以用select name from v$database语句来查询。
就这样,如果成功的话,看提示就知道了,不成功的话,肯定还是有其他问题!
================================================

错误1:

ORA-01078: failure in processing system parameters

SQL> startup

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file '/opt/oracle10g/product/10.2/db_1/dbs/initORA10G.ora'

查找文件,果然不存在。估计是非法关机造成的。

这是因为在oracle9i和oracle10g中,oracle默认将使用spfile启动数据库,如果spfile不存在,则就会出现上述错误。

解决方法1(已经验证):

将$ORACLE_BASE/admin /数据库名称/pfile目录下的init.ora.012009233838形式的文件copy到$ORACLE_HOME/dbs目录下 initoracle.ora即可。(注:initoracle.ora中的oracle为你的实例名 ORACLE_SID):

错误2:ORA-01102: cannot mount database in EXCLUSIVE mode

 

在STARTUP一数据库时,发生如下错误:

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup
oracle instance started.

Total System Global Area 276824064 bytes
Fixed Size 778736 bytes
Variable Size 137371152 bytes
Database Buffers 138412032 bytes
Redo Buffers 262144 bytes
ORA-01102: cannot mount database in EXCLUSIVE mode

SQL> shutdown immediate
ORA-01507: database not mounted

oracle instance shut down.

GOOGLE一下,发现是lk<SID>文件造成的,该文件位于ORALCE_HOME下的dbs目录下,马上检查该文件:

[root@qa- oracle dbs]# fuser -u lkNDMSQA
lkNDMSQA: 6666( oracle ) 6668( oracle ) 6670( oracle ) 6672( oracle ) 6674( oracle ) 6676( oracle ) 6678( oracle ) 6680( oracle ) 6690( oracle ) 6692( oracle ) 6694( oracle ) 6696( oracle ) 6737( oracle ) 6830( oracle )

果然该文件没释放,用fuser命令kill掉:

[root@qa- oracle dbs]# fuser -k lkORCL
lkNDMSQA: 6666 6668 6670 6672 6674 6676 6678 6680 6690 6692 6694 6696 6737 6830
[root@qa- oracle dbs]# fuser -u lkORCL

然后:

SQL> startup
oracle instance started.

Total System Global Area 276824064 bytes
Fixed Size 778736 bytes
Variable Size 137371152 bytes
Database Buffers 138412032 bytes
Redo Buffers 262144 bytes
Database mounted.
Database opened.
SQL>

数据库成功OPEN.

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值