Oracle 11g支持修改数据库用户名
2014-03-27 09:34
483 查看
以下转自:/article/4304290.html 作者:ylw6006 Oracle 11g修改数据库用户名
2012-03-07 13:29:52标签:oracle11grename user休闲_enable_rename_user版权声明:原创作品,谢绝转载!否则将追究法律责任。 最近翻看某blog,发现原来oracle 11g提供了用户重命名的新特性,在10g环境下,如果想对用户重命名,一般来说是先创建一个新的用户并授权,然后将原用户下的所有对象导入,然后删除旧的用户!下面来在11g rac环境下介绍下这个新特性!参考:http://www.orafan.net/blog/315.html,感谢作者分享!一:创建一个测试用户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 andReal Application Testing options
SQL> createuser xxx identified by 123456 default tablespace users;
User created.
SQL> grant resource,connectto xxx;
Grant succeeded.
SQL> createtable xxx.test asselect * from dba_objects;
Table created.
SQL> alteruser xxx rename to yyy;
alteruser xxx rename to yyy
*
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> alteruser xxx rename to yyy identified by 123456;
alteruser 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 isnot running on node node1
Instance node2 isnot 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,namefrom v$database;
OPEN_MODE NAME
-------------------- ---------------
READ WRITE RAC
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
三:修改xxx用户名为yyySQL> 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启动racSQL> 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 andReal 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
2012-03-07 13:29:52标签:oracle11grename user休闲_enable_rename_user版权声明:原创作品,谢绝转载!否则将追究法律责任。 最近翻看某blog,发现原来oracle 11g提供了用户重命名的新特性,在10g环境下,如果想对用户重命名,一般来说是先创建一个新的用户并授权,然后将原用户下的所有对象导入,然后删除旧的用户!下面来在11g rac环境下介绍下这个新特性!参考:http://www.orafan.net/blog/315.html,感谢作者分享!一:创建一个测试用户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 andReal Application Testing options
SQL> createuser xxx identified by 123456 default tablespace users;
User created.
SQL> grant resource,connectto xxx;
Grant succeeded.
SQL> createtable xxx.test asselect * from dba_objects;
Table created.
SQL> alteruser xxx rename to yyy;
alteruser xxx rename to yyy
*
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> alteruser xxx rename to yyy identified by 123456;
alteruser 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 isnot running on node node1
Instance node2 isnot 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,namefrom v$database;
OPEN_MODE NAME
-------------------- ---------------
READ WRITE RAC
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
三:修改xxx用户名为yyySQL> 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启动racSQL> 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 andReal 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
相关文章推荐
- Oracle 11g修改数据库用户名
- oracle 11g 数据库, 创建表空间, 修改表空间, 创建用户,并将用户分配给表空间,将dmp
- 物理内存扩容,oracle 11g R1数据库相关参数修改
- 忘记oracle的sys用户密码怎么修改以及Oracle 11g 默认用户名和密码
- Oracle修改数据库用户名
- [分享] 数据库服务管理脚本,超好用! 支持oracle,mysql,sqlserver,tomcat(本人在源程序上修改的)
- oracle 11g 修改用户名
- ORACLE 11G 修改数据库端口并重新配置EM
- ORACLE 11G R2 修改"用户名"
- ORACLE 11g将数据库移动到不同的ASM磁盘组/修改ASM磁盘组的冗余属性
- Oracle 11g修改数据库字符集
- Oracle 11g 参数修改错误导致数据库无法启动的处理方法.[ORA-01034,ORA-27101]
- oracle 11g数据库修改字符集
- Oracle 11g参数修改错误导致数据库无法启动的处理方法.[ORA-01034,ORA-27101,ORA-00824]
- Oracle 免费的数据库--Database 快捷版 11g 安装使用与"SOD框架"对Oracle的CodeFirst支持
- 如何修改oracle 11G的字符集、用户名区分大小写、密码过期问题?
- Oracle 免费的数据库--Database 快捷版 11g 安装使用与"SOD框架"对Oracle的CodeFirst支持
- Oracle 11g Dos下 找回用户名和修改密码方法
- 数据库分库分表(sharding)系列(五) 一种支持自由规划无须数据迁移和修改路由代码的Sharding扩容方案
- 基于CentOS与VmwareStation10搭建Oracle11G RAC 64集群环境:4.安装Oracle RAC FAQ-4.7.Oracle 11G R2 RAC修改public网络IP