Dropdual

WBOY
풀어 주다: 2016-06-07 16:10:24
원래의
960명이 탐색했습니다.

有网友删除dual表出现了问题: 删除dual表的时候hang住,然后直接shutdown abort。再重新启动数据库的时候,发现open的时候一直hang住,但是打开另外一个窗口数据库确实已经打开的。 下面进行模拟: SYS@orcl11gdrop table dual; 一直hang在这不动 在另外一个

有网友删除dual表出现了问题:

删除dual表的时候hang住,然后直接shutdown abort。再重新启动数据库的时候,发现open的时候一直hang住,但是打开另外一个窗口数据库确实已经打开的。

下面进行模拟:

SYS@orcl11g>drop table dual;
로그인 후 복사

一直hang在这不动

在另外一个窗口:

SYS@orcl11g>shutdown abort
ORACLE instance shut down.
로그인 후 복사

重启数据库:
SYS@orcl11g>startup mount
ORACLE instance started.
Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             327157712 bytes
Database Buffers           83886080 bytes
Redo Buffers                4288512 bytes
Database mounted.
로그인 후 복사

SYS@orcl11g>alter database open;
로그인 후 복사

一直hang这个不动,打开另外一个窗口:
SYS@orcl11g>select open_mode from v$database;
OPEN_MODE
----------------------------------------
READ WRITE

SYS@orcl11g>
로그인 후 복사
发现数据库已经打开

这是因为系统触发器造成,在初始化参数中加入:
_system_trig_enabled=flase

再次启动数据库:

SYS@orcl11g>startup mount
ORACLE instance started.
Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             327157712 bytes
Database Buffers           83886080 bytes
Redo Buffers                4288512 bytes
Database mounted.
SYS@orcl11g>show parameter _sys
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
_system_trig_enabled                 boolean                FALSE
audit_sys_operations                 boolean                FALSE
audit_syslog_level                   string
filesystemio_options                 string                 none
ldap_directory_sysauth               string                 no
SYS@orcl11g>alter database open;

Database altered.
로그인 후 복사
最开始删除dual表的时候也是因为系统触发器的存在。

现在我们禁用了系统触发器将dual删除看是什么效果:

SYS@orcl11g>drop table dual;

Table dropped.
로그인 후 복사

重启数据库:

SYS@orcl11g>startup nomount pfile=initorcl11g.ora
ORACLE instance started.
Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             327157712 bytes
Database Buffers           83886080 bytes
Redo Buffers                4288512 bytes
SYS@orcl11g>show parameter rep
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
replication_dependency_tracking      boolean                TRUE
SYS@orcl11g>
SYS@orcl11g>
SYS@orcl11g>
SYS@orcl11g>
SYS@orcl11g>alter database mount;

Database altered.

SYS@orcl11g>alter database open;
alter database open
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-01775: looping chain of synonyms
Process ID: 2485
Session ID: 1 Serial number: 3
로그인 후 복사

这里我们不用trace就知道是因为dual表的缘故,所以dual也是很重要的。不要乱玩

这时候我们需要将REPLICATION_DEPENDENCY_TRACKING参数设置为False才能打开数据库:
官方文档给出的解释:
REPLICATION_DEPENDENCY_TRACKING enables or disables dependency tracking for
read/write operations to the database. Dependency tracking is essential for
propagating changes in a replicated environment in parallel

加入参数打开数据库:

SYS@orcl11g>startup mount
ORACLE instance started.
Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             327157712 bytes
Database Buffers           83886080 bytes
Redo Buffers                4288512 bytes
Database mounted.
SYS@orcl11g>show parameter rep
NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
replication_dependency_tracking      boolean                FALSE
SYS@orcl11g>ak^H
SP2-0042: unknown command "a" - rest of line ignored.
SYS@orcl11g>a;ter^H
SYS@orcl11g>alter database open;

Database altered.

SYS@orcl11g>select * from dual;
select * from dual
              *
ERROR at line 1:
ORA-01775: looping chain of synonyms
로그인 후 복사
这时候我们呢需要重建dual表:

SYS@orcl11g>CREATE TABLE "SYS"."DUAL"
  2       (  "DUMMY" VARCHAR2(1)
  3       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
  4     NOCOMPRESS LOGGING
  5      STORAGE(INITIAL 16384 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  6      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
  7      BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
  8      TABLESPACE "SYSTEM" ;


Table created.

SYS@orcl11g>SYS@orcl11g>GRANT SELECT ON "SYS"."DUAL" TO PUBLIC WITH GRANT OPTION;


Grant succeeded.

SYS@orcl11g>SYS@orcl11g>@?/rdbms/admin/utlrp.sql
로그인 후 복사

至此我们dual已经恢复完成

SYS@orcl11g>select 'www.zbdba.com' from dual;
'WWW.ZBDBA.COM'
--------------------------
www.zbdba.com
로그인 후 복사




관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿