Oracle故障排除

Oracle故障排除

        Oracle 11g数据库故障排除的记录本。

SP2-0618: Cannot find the Session Identifier

1
2
3
SQL> set autotrace on
SP2-0618: Cannot find the Session Identifier. Check PLUSTRACE role is enabled
SP2-0611: Error enabling STATISTICS report

原因是该账户没有PLUSTRACE角色查看$ORACLE_HOME/sqlplus/admin的plustrce.sql发现如下内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
-- Copyright (c) Oracle Corporation 1995, 2002. All Rights Reserved.
--
-- NAME
-- plustrce.sql
--
-- DESCRIPTION
-- Creates a role with access to Dynamic Performance Tables
-- for the SQL*Plus SET AUTOTRACE ... STATISTICS command.
-- After this script has been run, each user requiring access to
-- the AUTOTRACE feature should be granted the PLUSTRACE role by
-- the DBA.
--
-- USAGE
-- sqlplus "sys/knl_test7 as sysdba" @plustrce
--
-- Catalog.sql must have been run before this file is run.
-- This file must be run while connected to a DBA schema.

以sysdba用户执行下列语句即可正常使用autotrace功能。

1
2
3
4
5
6
7
8
set echo on
drop role plustrace;
create role plustrace;
grant select on v_$sesstat to plustrace;
grant select on v_$statname to plustrace;
grant select on v_$mystat to plustrace;
grant plustrace to dba with admin option;
set echo off

SQLPLUS友善化输出

set linesize 200:设置行宽,表示行宽被设置为200的字符
column name format a40:设置列宽,设置name列为40个字符,a表示alphanumeric,字符的意思
set pagesize 20:设置页面记录,设置每20行为一列

sqlplus命令是会话级的,exit之后就消失了。setlinesize 5000 exit之后作用就消失了

启动em时报错:OC4J Configuration issue

修改hostname后报错:修改对应文件。
版本升级后

1
[oracle@192~ config]$ emca -config dbcontrol db

sqlplus方向键问题

1
2
3
4
5
6
7
8
9
10
[root@localhost ~]# rpm -ivh rlwrap-0.37-1.el5.i386.rpm
[root@localhost ~]# su - grid
[grid@localhost ~]$ vi .bash_profile
[grid@localhost ~]$ source .bash_profile
[grid@localhost ~]$ exit
logout
[root@localhost ~]# su - oracle
[oracle@localhost ~]$ vi .bash_profile
[oracle@localhost ~]$ source .bash_profile
在.bash_profile 文件中加入了 alias sqlplus='rlwrap sqlplus'

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×