Ora-01031: insufficient privileges when I create the first user - oracle

I tried to create a user after creating tablespaces but there is an error at line 1, ORA-01031: insufficient privileges.
This is what I wrote and the effect ...
Enter user-name: sys as sysdba
Enter password:
Connected to:
Oracle Database 12c Enterprise Release 12.1.0.1.0
SQL> create user c##ntoi identified by botho123
2 container=all
3 default tablespace perm_ntoi_tbs
4 temporary tablespace temp_ntoi_tbs;
create user c##ntoi identified by botho123
*
ERROR at line 1:
ORA-01031: insufficient privileges

According to the create user command for the version you're connected to:
To specify the CONTAINER clause, you must be connected to a multitenant container database (CDB). To specify CONTAINER = ALL, the current container must be the root. To specify CONTAINER = CURRENT, the current container must be a pluggable database (PDB).
Maybe your environment is set such that connecting to "sys as sysdba" is connecting to:
a pluggable instead of its container
a current container that is not the root

I have created the user by connecting with
SQL> conn c##sys
I got another problem when granting the user
SQL> grant sysdba, connect, create user, create session to c##ntoi;
ERROR at line 1:
ORA-47410: Realm violation for GRANT on CREATE SESSION

Related

oracle 11g not able to connect with scott user, showing: invalid username/password; logon denied

whenever I'm trying to connect with scott it is showing invalid username/password,
tried this:
alter user scott account unlock;
SP2-0640: Not connected
alter user scott identified by tiger;
SP2-0640: Not connected
Go to the Installing path of the Oracle 11g In default it is present C: Drive, then move to C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin
here you can find a file named scott.sql
Open the SQL Command Line and login as conn system/ (password set during the installation of oracle 11g)
Run the Below script (Note: File name is appended at the end)
# C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\scott.sql
Now you can query the SELECT * FROM all_users; to see the scott schema created
Alternatively you can do this by using SQL developer by creating a connection to SYSTEM and run the above script
After the creation the default username : SCOTT password: TIGER
In the comment part i especially asked for querying
select count(1) from dba_users where username = 'SCOTT';. I'd like to learn if user exists.
For the message you get ORA-01017,
the First possible reason is what message tells us(invalid
username/password).
Secondly, you may not have an account named SCOTT. i.e. the above
query gives 0(zero).
In this case :
you should create mentioned user ( when you're connected to system ):
SQL> conn system/pwd
Connected.
SQL> create user scott identified by tiger;
and grant related privileges :
SQL> grant connect to scott;
SQL> grant resource to scott;
and then you can connect by issuing :
SQL> conn scott/tiger
Connected.
Connect with a DBA Account and Issue an Alter User Command
The error you are seeing indicates you are no longer connected to the database. You were logged in as system#db, but when you tried to connect as scott#db, you no longer have a database connection.
Here I replicate your experience:
SYSTEM#db>conn system#db as sysdba
Enter password:
Connected.
SYS#db>conn scott#db
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied
#>alter user account scott unlock;
SP2-0640: Not connected
#>alter user scott identified by tiger;
SP2-0640: Not connected
Here I reconnect and then issue an alter user command to unlock the user account and set a new password.
#>conn system#db as sysdba
Enter password:
Connected.
SYS#db>ALTER USER scott IDENTIFIED BY tiger ACCOUNT UNLOCK;
User altered.
SYS#db>conn scott/tiger#db
Connected.
Addendum
My steps provided assumed you had the scott schema installed. If the scott schema does not exist, it would be good to see if the default 11g database sample schemas exist.
The schema account scott is no longer a default schema in the 11g database. The 11g documentation states:
"Oracle used the schema SCOTT with its two prominent tables EMP and
DEPT for many years. With advances in Oracle Database technology,
these tables have become inadequate to show even the most basic
features of Oracle Database and other Oracle products. "
I would recommend reviewing to see if the other default sample schemas are installed. The hr account is most similar to the scott schema.
Here is a list of common sample schema usernames:
username IN (
'HR',
'OE',
'PM',
'SH',
'IX'
)
Check to see if the person whom performed the installation used the database configuration assistant and opted to install the sample schemas.
If the schemas were not created at the time of installation, the document, "Oracle® Database Sample Schemas 11g Release 1 (11.1) B28328-03", describes the steps to do this in chapter 2, Installation.
Open Oracle sql developer.
In the sql developer paste the path of scott.sql file(C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\scott.sql) with '#' infront of it.
# C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\scott.sql
Run script
Script Output -> Connection created by CONNECT script command disconnected
Connect using SQL Command Line
conn scott/TIGER;

ORA-65175: cannot grant SYSDBA privilege locally in the root

I have a oracle 12c database .
I would like to grant sysdba to C##user1.
Here is user table.
When I execute this command I can get a error.
grant sysdba to c##user1 container=current
Error report -
SQL Error: ORA-65175: cannot grant SYSDBA privilege locally in the root
65175. 00000 - "cannot grant SYSDBA privilege locally in the root"
*Cause: An attempt was made to grant SYSDBA privilege locally in the root
of a multitenant container database (CDB).
*Action: While connected to the root, SYSDBA privilege can only be granted
commonly.
and when I execute this command , I can get 2 users of C##user1.
grant sysdba to c##user1 container=all
How can I grant sysdba to C##user1.
Thank you for viewing.
Pls help me.
Are you trying to grant sysdba to c##user1 at the Container or Root level? This is an important distinction within 12C, as the Container is logically separate from the rest of the CDB. The CON_ID column will tell you where each user resides - Con_ID=0 means that the row pertains to the entire CDB, whereas CON_ID=1 means that the row pertains to the root.
You currently have two "C##user1" users, one is a common user that is present in all containers (CON_ID=0,) and the other is a local user that is specific to the root.
You already have one "C##user1" user that has the SYSDBA privilege on the entire CDB, so if that's what you want, you can connect to the root and drop the local "C##user1" user. If you just wanted a local user with the SYSDBA privilege on that root only, I would recommend dropping the "C##user1" common user, then connecting to the root and granting sysdba to the local user there.
The article I linked to is titled "Overview of the Multitenant Architecture", I would suggest giving it a review before you make a decision either way.
under cdb connection try it
grant sysdba to c##user1 container=all

Oracle ORA-01031: insufficient privileges while creating user

I have created a user, let's call him C##USER from sysdba. Now, I'm trying to create another user from C##USER. Problem is I keep getting the following error:
ORA-01031: insufficient privileges
I have granted C##USER all privileges and have set the default role to ALL. Nothing works yet...
Any ideas? Thanks in advance.
You just need a CREATE USER system privilege BUT don't forget to use CONTAINERclause which should be set to ALL, if you omit this clause then the grantee will have CREATE USER system privilege on the current container.
Specify CONTAINER = ALL to commonly grant a system privilege, object privilege on a common object, or role, to a common user or common role
GRANT
When a common user account is created, the account is created in all of the open pluggable databases. So the user who is creating this new user must have CREATE USER system privilege on all containers.
SQL> grant create user to c##user container=all;
Grant succeeded.
SQL> conn c##user
Enter password:
Connected.
SQL> create user c##user2 identified by user2;
User created.

Oracle can only login as sysdba / can't login with configured user?

So I created the user w3038519 in the Oracle database configuration as I was installing Oracle yet it does not let me login with it.
C:\Users\Chris>sqlplus w13038519/mypass
SQL*Plus: Release 12.1.0.1.0 Production on Fri Aug 14 00:26:16 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
Could the account be locked somehow? Is there any way I can unlock it or create another user? The following doesn't work
sqlplus w13038519/mypass as sysdba
sqlplus osauthentication/anyuserpass as sysdba
SQL> create user chris
2 identified by chrispass
3 ;
create user chris
*
ERROR at line 1:
ORA-65096: invalid common user or role name
SQL> create user C##chris
2 identified by chrispass
3 ;
create user C##chris
*
ERROR at line 1:
ORA-65048: error encountered when processing the current DDL statement in
pluggable database PDBORCL
ORA-01031: insufficient privileges
I can't do anything I need to with sysdba because you can't create triggers logged in sysdba
I watched some tutorial and the person just setup sysdba as I have done and now can't use triggers.
I hate oracle so much. It's so retarded to use the most unideal platform there is
You have created a container database instead of a traditional one. In this case, When you use / as sysdba, you connect to the root container, where you can not create reguler users, only common users (starting with c##), so your user w13038519 can not exist in the root container. Run the below query:
select con_id from cdb_users where username = 'W13038519';
CON_ID
----------
3
This should return the container database where your user was created. If you get no result, your user does not exist. To find the name of the container:
SQL> select name from v$pdbs where con_id = 3;
NAME
------------------------------
PDB1
If you have a TNS entry pointing to that container database, you can connect as:
sqlplus w13038519/september23#PDB1
If you do not need the Multitenant Architechture specifically, you will save yourself a lot of trouble by creating a traditional database.
create user C##TESTDB identified by TESTDB container = all;
ORA-65048: error encountered when processing the current DDL statement in
pluggable database PDBORCL
ORA-01031: insufficient privileges
in my case this worked
alter session set "_oracle_script"=true;
create user C##TESTDB identified by TESTDB;
user created;

ORA-2800: account is locked error in qtp

I am getting the following error while connecting to db for checking db timings through QTP scripts:
"Cannot update system time with database time due to error: ERROR: [Oracle][ODBC][Ora]ORA-28000: the account is locked"
But the database SID and credentials given are correct and verified the same in some db client. I am not sure why its throwing error in QTP?
Can anyone please help me resolve the issue?
1) Login to your Oracle Database using admin privileges:
cmd> sqlplus / as sysdba
or
cmd> sqlplus system/{systemPassword}#{OracleSID}
2) Unlock your user's account using the following command:
sql> alter user {yourDbUser} account unlock;
3) Still in SQL*Plus command prompt, prevent account locks to not occur again:
sql> ALTER PROFILE "DEFAULT" LIMIT PASSWORD_LIFE_TIME UNLIMITED;
sql> ALTER PROFILE "DEFAULT" LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED;
Edit due comment
The above instructions should solve your problem. I'm posting an additional command I've found related to this subject you can try (I'm not confident it is the solution though):
sql> grant connect, resource to {yourDbUser};
You can also check for the status of other locked users in your database. Maybe your tool is trying to connect with some other user that, besides the one you are using, still have this issue.
This solution is for Oracle 10g and error ORA-28000:the account is locked
Type in the SQL Command Line:
conn sys as sysdba
enter password
alter user system account unlock;

Resources