I'd like to create a user on another server using a db link. Is this possible? (Lets assume I have permission)

Here's the syntax for creating a user on the local server

create user TEST_USER 
identified by TEST_USER_PW 
default tablespace USERS 
temporary tablespace TEMP;

How could it be done with a db link?

Thank you (Feel free to migrate this to DBA if it's off topic)

Edit: Haki brought up that DDL operations are not allowed on a remote database. I'll post an alternative once I find one.

有帮助吗?

解决方案

You can execute DDL on over a database link using DBMS_UTILITY.EXEC_DDL_STATEMENT:

begin
    dbms_utility.exec_ddl_statement@myself(
        'create user TEST_USER 
        identified by TEST_USER_PW 
        default tablespace USERS 
        temporary tablespace TEMP');
end;
/
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top