[20121009]global_name是什么.txt
看看与学习global_names是什么在11GR2.
SQL> select * from v$version ;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> select * from global_name;
GLOBAL_NAME
-----------
TEST.COM
SQL> column object_name format a20
SQL> column owner format a20
SQL> SELECT owner, object_name, object_id, data_object_id, object_type FROM dba_objects WHERE object_name = 'GLOBAL_NAME';
OWNER OBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
-------------------- -------------------- ---------- -------------- -------------------
SYS GLOBAL_NAME 3327 VIEW
PUBLIC GLOBAL_NAME 3328 SYNONYM
--可以看出普通用户通过SYNONYM的GLOBAL_NAME访问.
--看看同义词的定义:
SQL> column db_link format a20
SQL> SELECT * FROM dba_synonyms WHERE wner = 'PUBLIC' AND synonym_name = 'GLOBAL_NAME';
OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME DB_LINK
------------------------------ ------------------------------ ------------------------------ ------------------------------ --------------------
PUBLIC GLOBAL_NAME SYS GLOBAL_NAME
--推出通过同义词访问view,再看看view的定义:
SQL> column text format a60
SQL> SELECT owner,view_name,text_length,text FROM dba_views WHERE wner = 'SYS' AND view_name = 'GLOBAL_NAME';
OWNER VIEW_NAME TEXT_LENGTH TEXT
------------------------------ ------------------------------ ----------- ------------------------------------------------------------
SYS GLOBAL_NAME 59 select value$ from sys.props$ where name = 'GLOBAL_DB_NAME'
--可以看出最后访问的对象是select value$ from sys.props$ where name = 'GLOBAL_DB_NAME'.
SQL> select rowid x,a.* from sys.props$ a where name='GLOBAL_DB_NAME';
X NAME VALUE$ COMMENT$
------------------ -------------------- ------------------------------ --------------------
AAAABiAABAAAAMhAAf GLOBAL_DB_NAME TEST.COM Global database name
SQL> @ lookup_rowid.sql AAAABiAABAAAAMhAAf
OBJECT FILE BLOCK ROW
---------- ---------- ---------- ----------
98 1 801 31
---理解这些东西主要目的是为了下面bbed的学习做一些准备,因为在10g以上版本如果执行:
update global_name set global_name='';
commit;
下次开机时,出现如下提示:
SQL> startup
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size 2215064 bytes
Variable Size 1728054120 bytes
Database Buffers 402653184 bytes
Redo Buffers 4964352 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-00600: internal error code, arguments: [18062], [], [], [], [], [], [], [], [], [], [], []
Process ID: 632
Session ID: 530 Serial number: 3
--许多blog都提到不能修改global_name为空.
最好使用
alter database rename global_name to xxxx.com;
时间: 2024-10-31 15:19:05