Oracle 11g修改資料庫使用者名稱
oracle 11g提供了使用者重新命名的新特性,在10g環境下,如果想對使用者重新命名,一般來說是先建立一個新的使用者並授權,然後將原使用者下的所有物件匯入,然後刪除舊的使用者!下面來在11g rac環境下介紹下這個新特性! (對於10g可以使用可傳輸表空間來實現、或者匯出匯入)
一:建立一個測試使用者xxx,並寫入測試資料,由spfile檔案生成pfile檔案,關閉rac資料庫
- [oracle@node1 ~]$ sqlplus sys/Ab123456@rac5 as sysdba
- SQL*Plus: Release 11.2.0.3.0 Production on Tue Mar 6 19:42:12 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- Connected to:
- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
- With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
- Data Mining and Real Application Testing options
- SQL> create user xxx identified by 123456 default tablespace users;
- User created.
- SQL> grant resource,connect to xxx;
- Grant succeeded.
- SQL> create table xxx.test as select * from dba_objects;
- Table created.
- SQL> alter user xxx rename to yyy;
- alter user xxx rename to yyy
- *
- ERROR at line 1:
- ORA-00922: missing or invalid option
- SQL> alter user xxx rename to yyy identified by 123456;
- alter user xxx rename to yyy identified by 123456
- *
- ERROR at line 1:
- ORA-00922: missing or invalid option
- SQL> create pfile from spfile;
- File created.
- [oracle@node1 ~]$ srvctl stop database -d rac -o immediate
- [oracle@node1 ~]$ srvctl status database -d rac
- Instance node1 is not running on node node1
- Instance node2 is not running on node node2
二:修改pfile檔案,新增隱含引數 *._enable_rename_user='TRUE',將資料庫以restrict方式啟動
- [oracle@node1 ~]$ cd /u01/app/oracle/product/11.2.0/db1/dbs/
- [oracle@node1 dbs]$ ls
- hc_node1.dat initnode1.ora init.ora orapwnode1
- [oracle@node1 dbs]$ tail -1 initnode1.ora
- *._enable_rename_user='TRUE'
- [oracle@node1 dbs]$ sqlplus /nolog
- SQL*Plus: Release 11.2.0.3.0 Production on Tue Mar 6 19:51:41 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- SQL> conn /as sysdba
- Connected to an idle instance.
- SQL> startup restrict pfile=$ORACLE_HOME/dbs/initnode1.ora
- ORACLE instance started.
- Total System Global Area 1235959808 bytes
- Fixed Size 2227904 bytes
- Variable Size 805306688 bytes
- Database Buffers 419430400 bytes
- Redo Buffers 8994816 bytes
- Database mounted.
- Database opened.
- SQL> select open_mode,name from v$database;
- OPEN_MODE NAME
- -------------------- ---------------
- READ WRITE RAC
- SQL> show parameter spfile;
- NAME TYPE VALUE
- ------------------------------------ ----------- ------------------------------
- spfile string
三:修改xxx使用者名稱為yyy
- SQL> alter user xxx rename to yyy;
- alter user xxx rename to yyy
- *
- ERROR at line 1:
- ORA-02000: missing IDENTIFIED keyword
- SQL> alter user xxx rename to yyy identified by 123456;
- User altered.
- SQL> select count(*) from yyy.test;
- COUNT(*)
- ----------
- 74556
四:使用spfile啟動rac
- SQL> shutdown immediate;
- Database closed.
- Database dismounted.
- ORACLE instance shut down.
- [oracle@node1 dbs]$ srvctl start database -d rac
- [oracle@node1 dbs]$ srvctl status database -d rac
- Instance node1 is running on node node1
- Instance node2 is running on node node2
五:連線測試,由此可見,對使用者的rename操作,可以繼承原有的許可權
- SQL*Plus: Release 11.2.0.3.0 Production on Tue Mar 6 20:00:52 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- Connected to:
- Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
- With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
- Data Mining and Real Application Testing options
- SQL> select * from tab;
- TNAME TABTYPE CLUSTERID
- ------------------------------ ------- ----------
- TEST TABLE
- [oracle@node1 ~]$ sqlplus xxx/123456@rac5
- SQL*Plus: Release 11.2.0.3.0 Production on Tue Mar 6 20:01:22 2012
- Copyright (c) 1982, 2011, Oracle. All rights reserved.
- ERROR:
- ORA-01017: invalid username/password; logon denied
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23071790/viewspace-732077/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11g支援修改資料庫使用者名稱Oracle資料庫
- 修改資料庫名稱資料庫
- ORACLE 11G R2 修改"使用者名稱"Oracle
- nid修改資料庫名稱資料庫
- 如何修改MySQL資料庫名稱MySql資料庫
- Oracle NID工具修改資料庫DBID和資料庫名稱Oracle資料庫
- 快速修改Oracle使用者名稱Oracle
- 用NID修改資料庫名稱資料庫
- 二、修改資料庫全域性名稱資料庫
- 在RAC中用NID修改資料庫名稱資料庫
- ***批次修改資料夾名稱
- ORACLE資料庫修改資料庫名db_nameOracle資料庫
- oracle11g修改使用者名稱Oracle
- 修改oracle使用者名稱,表空間名字,Oracle
- 【原創】使用nid命令修改資料庫名稱資料庫
- 使用NID修改Oracle資料庫名Oracle資料庫
- 使用“基表修改法”快速修改Oracle使用者名稱(z)Oracle
- 【USER】使用“基表修改法”快速修改Oracle使用者名稱Oracle
- win10修改使用者名稱資料夾方法 win10怎麼改使用者資料夾名稱Win10
- oracle中的某一個使用者名稱修改Oracle
- 修改oracle中的使用者名稱和密碼Oracle密碼
- github修改使用者名稱Github
- win10怎麼更改使用者名稱資料夾_win10如何修改suers使用者名稱資料夾Win10
- 本地oracle資料庫忘記使用者名稱密碼解決方案Oracle資料庫密碼
- 關於修改資料庫名稱和ID的方法總結資料庫
- 查詢當前資料庫名、使用者名稱、資料庫伺服器IP、埠、資料庫版本資訊。資料庫伺服器
- 關於資料庫登陸名和資料庫使用者名稱的一點點心得資料庫
- SQL資料庫使用者只有“名稱”而無“登陸名”解決SQL資料庫
- mongodb對資料庫建立使用者名稱和密碼MongoDB資料庫密碼
- Oracle 11g使用者名稱密碼區分大小寫Oracle密碼
- 【引數】ORACLE修改資料庫名之完整版Oracle資料庫
- C#取資料庫名稱與資料庫中表名的方法C#資料庫
- 修改oracle例項名(sid)和資料庫名(db_name)Oracle資料庫
- 修改 linux&unix 使用者名稱Linux
- mongodb怎樣給本地資料庫新增使用者名稱密碼和修改賬號密碼?MongoDB資料庫密碼
- oracle 11g 修改資料庫名字和例項名字Oracle資料庫
- SQL Server還原資料庫,修改還原後的物理檔名稱SQLServer資料庫
- 修改 Ubuntu 系統使用者名稱和登入名Ubuntu