Oracle创建数据库链接报错ORA-01031:权限不足问题求助
The ORA-01031 error here is straightforward: your user account doesn't have the necessary system privileges to create a database link. Here's how to resolve this step by step:
1. Identify the Required Privileges
You need one of the following privileges depending on the type of database link you want to create:
- Private database link (only accessible by your user):
CREATE DATABASE LINK - Public database link (accessible by all users in the local database):
CREATE PUBLIC DATABASE LINK
Additionally, the remote user you're connecting to (username in your statement) must have the CREATE SESSION privilege on the remote Oracle database (this is usually granted by default to most user accounts, but it's worth verifying if you run into further issues).
2. Ask Your DBA to Grant the Privilege
Have a user with DBA privileges execute the appropriate GRANT statement:
- For a private link:
GRANT CREATE DATABASE LINK TO your_local_username; - For a public link:
GRANT CREATE PUBLIC DATABASE LINK TO your_local_username;
3. Verify the Privilege Was Granted
You can confirm the privilege is now assigned to your user by running this query:
SELECT PRIVILEGE FROM USER_SYS_PRIVS WHERE PRIVILEGE IN ('CREATE DATABASE LINK', 'CREATE PUBLIC DATABASE LINK');
4. Re-run Your Database Link Creation Statement
Once the privilege is in place, execute your original statement again (make sure to replace username, password, and confirm that 'ITEMS' is a valid TNS alias configured in your local tnsnames.ora file):
CREATE DATABASE LINK ITEMS CONNECT TO username IDENTIFIED BY password USING 'ITEMS';
A quick note: If you're logged in as a SYSDBA user, you already have these privileges by default—this issue only affects standard user accounts that haven't been granted explicit permissions to create database links.
内容的提问来源于stack exchange,提问作者SRVFan




