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

Linux ORACLE 基本操作

2012-05-13 20:00 405 查看
手动启动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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: