ユーザ名、スキーマ名の変更

(8.0.29)
https://www.dbonline.jp/mysql/user/index3.html


select user,host from mysql.user;

rename user user1@'%' to user2@'%';

 

(19c)


コマンドでの実行は不可

expdp test/test@pdb1 directory=ORA_DIR dumpfile=a.dmp logfile=a.log schemas=user1 reuse_dumpfiles=yes

impdp test/test@pdb1 directory=ORA_DIR dumpfile=a.dmp logfile=a.log schemas=user1 remap_schema=user1:user2


drop user user1 cascade;

 

(14)
https://www.dbonline.jp/postgresql/role/index7.html

\du
\dn

alter user user1 rename to user2;

※NOTICE:  MD5 password cleared because of role renameと表示された場合、パスワードを再設定する

alter schema schema1 rename to schema2;

(2019)
https://www.ipentec.com/document/sql-server-change-table-scheme

 

select name,principal_id from sys.server_principals;
select name,principal_id from sys.database_principals;
select * from sys.schemas;

 

alter user user1 with name = user2;
alter login login1 with name = login2;

 

スキーマ名のコマンドでの直接変更はできない。
テーブルの属するスキーマの変更は下記コマンドで可能

create schema schema2;
alter schema schema2 transfer schema1.tab1;