0%

Oracle报错解决

ORA-00020

超出最大进程数

报错信息

1
ORA-00020: maximum number of processes (150) exceeded

查询当前默认配置的 process 是多少

常规方法无法登录,我们连接时候要加上-prelim参数

1
$ sqlplus -prelim/ as sysdba
1
2
3
4
5
6
7
8
9
10
11
12
SQL> set linesize 500;
SQL> show parameter processes;

NAME TYPE VALUE
------------------------------------ ---------------------- ------------------------------
aq_tm_processes integer 1
db_writer_processes integer 1
gcs_server_processes integer 0
global_txn_processes integer 1
job_queue_processes integer 1000
log_archive_max_processes integer 4
processes integer 150

修改 processes 到500

1
2
3
SQL> alter system set processes=500 scope = spfile;
SQL> shutdown immediate;
SQL> startup

ORA-10458、ORA-01196、ORA-01110

Oracle DG 备库启动报错如下

1
2
3
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/oradata/orcl/datafile1/system01.dbf'

在备库执行

1
2
3
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database recover managed standby database using current logfile disconnect from session;

在主库上切换日志

1
2
SQL> alter system switch logfile;
sql> select SEQUENCE#, FIRST_TIME, NEXT_TIME, APPLIED, ARCHIVED from V$ARCHIVED_LOG order by FIRST_TIME;

如果返回结果APPLIED都是YES或者只有最后一个是NO的话,说明全部归档日志全部已经归档完了,此时到备库上上操作:

1
2
3
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
SQL> alter database recover managed standby database using current logfile disconnect from session;

以上操作仍无法解决可能需要以下操作

手动归档

关闭主库shutdown immediate

拷贝归档日志到从库,并进行注册

1
2
SQL> alter database register physical logfile '/data/oracle/archivelog/1_758_991156185.dbf';
SQL> alter database register physical logfile '/data/oracle/archivelog/1_759_991156185.dbf';

重启主从(注意顺序)

复制密码文件

a) 关闭主库和备库:shutdown immediate

b) 将主库的密码文件复制到备库(在主库操作)

1
$ scp $ORACLE_HOME/dbs/orapworcl oracle@standbydb:$ORACLE_HOME/dbs/

Oracle CPU占用率高排查

通过 top 获得占用率高的 pid,使用 pid 查询获得 addr

1
sql> select addr from v$process where spid=94499;

使用 addr 查询获得 sql_id

1
sql> select sql_id from v$session where paddr='000000008CCB5A70';

使用sql_id 获得具体 sql

1
sql> select * from v$sql where sql_id = '86bb6nk7x0bc2';
-------------    本文结束  感谢您的阅读    -------------