oracle 如何更改架构名称?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18730850/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 05:16:54  来源:igfitidea点击:

How to change schema name?

oracleplsqlschemaoracle11gr2

提问by adelak

I have created a user:

我创建了一个用户:

CREATE USER gds_map
IDENTIFIED BY gds_map;

And now I need to change a name. I tried to update or find other way but have not found nothing yet.

现在我需要改变一个名字。我试图更新或寻找其他方式,但还没有找到任何东西。

I will be glad of any hint.

我会很高兴任何提示。

采纳答案by Justin Cave

You can't (at least not in a supported or vaguely responsible way). You'd need to create a new user with the new username and drop the old user.

您不能(至少不能以支持或含糊其辞的方式)。您需要使用新用户名创建一个新用户并删除旧用户。

回答by mohamed stitane

If you want to modify a schema's name,you should have the preveledegs on USER$

如果你想修改一个模式的名字,你应该在 USER$ 上有 preveledegs

1. Get Id of a schema's name

1.获取架构名称的Id

SQL> select user#,NAME from SYS.user$ WHERE NAME='TEST';
USER# NAME
---------- ------------------------------
*93* TEST

2. modify the schema's name

2.修改schema的名称

SQL> UPDATE USER$ SET NAME='NEW_SCHEMA_NAME' WHERE USER#=93;

3. finished commit

3. 完成提交

SQL> COMMIT;

4. modify the system SCN

4.修改系统SCN

SQL> ALTER SYSTEM CHECKPOINT;

5.Then refresh shared_pool

5.然后刷新shared_pool

SQL> ALTER SYSTEM FLUSH SHARED_POOL;

6. Modify the new schema's password

6.修改新架构的密码

SQL> ALTER USER new_schema  IDENTIFIED BY new_pass;

回答by Dba

No methods exists to rename an oracle schema.

不存在重命名 oracle 模式的方法。

Try,

尝试,

1-Create new schema

1-创建新模式

2-Export the old schema,

2-导出旧架构,

$exp owner=test2

3-Import old schema to new schema,

3-将旧模式导入新模式,

$imp fromuser=test2 touser=newuser_name

回答by Firas Nizam

do this

做这个

1- login as sys

1- 以系统身份登录

2- execute this: update sys.user$ set name= 'new_name' where name = 'old_name';

2- 执行这个:update sys.user$ set name='new_name' where name = 'old_name';

3- then restart the database

3-然后重启数据库

回答by Rodrigo de Araujo Jorge

I've needed to do this so often that I even wrote an article about this topic

我经常需要这样做,我什至写了一篇关于这个主题的文章

The workaround that I use is to "clone" the user to the same DB with a different name, using loopback dblink.

我使用的解决方法是使用环回 dblink 将用户“克隆”到具有不同名称的同一个数据库。

It's very fast and in the end, after a successful checkup, you can drop the old schema.

它非常快,最后,在成功检查后,您可以删除旧模式。

Check it here: http://www.dbarj.com.br/en/2014/11/rename-schema-oracle-11g-loopback-dblink/

在这里检查:http: //www.dbarj.com.br/en/2014/11/rename-schema-oracle-11g-loopback-dblink/

Regards,

问候,

Rodrigo Jorge

罗德里戈·豪尔赫

回答by manoranjan sethy

In oracle database you cannot rename your username but you can change your password.

在 oracle 数据库中,您不能重命名用户名,但可以更改密码。

alter user USER_NAME identified by <enter_new_password>;