Oracle database SQLPLUS: How to enter password has character #? - oracle

Oracle database 21c express edition on Windows 11.
My error
ORA-12154: TNS:could not resolve the connect identifier specified
My password is xxxxxa# . I see https://stackoverflow.com/a/67141887/3728901 How to enter password?
Update: Thank to Connor's answer. I catch
Microsoft Windows [Version 10.0.19044.1889]
(c) Microsoft Corporation. All rights reserved.
C:\Users\Administrator>sqlplus /nolog
SQL*Plus: Release 21.0.0.0.0 - Production on Thu Aug 25 10:21:18 2022
Version 21.3.0.0.0
Copyright (c) 1982, 2021, Oracle. All rights reserved.
SQL> connect sys/"123456a#"#xe
ERROR:
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
SQL>

Double quotes are your friend here
SQL> create user XXX identified by 123#456;
create user XXX identified by 123#456
*
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> create user XXX identified by "123#456";
User created.
SQL> grant create session to xxx;
Grant succeeded.
SQL> connect xxx/123#456#db19_pdb1
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Warning: You are no longer connected to ORACLE.
SQL> connect xxx/"123#456"#db19_pdb1 as sysdba
Connected.

sqlplus /nolog
connect sys/"123456a#"#xe as sysdba
SQL> alter session set "_ORACLE_SCRIPT"=true;
SQL> create user donhuvy identified by "123456a#";
SQL> grant create session to donhuvy;
SQL> connect donhuvy/"123456a#"#xe

Related

Oracle sqlplus with sys as sysdba is failing with ORA-01017: invalid username/password; logon denied

Oracle sys user database connection with ORACLE_SID is not working. dev is my ORACLE_SID .
sqlplus sys/manager#dev as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Nov 25 01:25:33 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
But without ORACLE_SID connection is working
sqlplus sys/manager as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Nov 25 01:34:05 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
Looks like this connection is using OS authentication. Because if I provide wrong password for sys user still connection works.
Any help why with ORACLE_SID sys user connection is not working?
In my database sec_case_sensitive_logon parameter is set to false.
SQL> show parameter sec_case_sensitive_logon
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
sec_case_sensitive_logon boolean FALSE
Following was the root cause:
remote_login_passwordfile parameter was set to EXCLUSIVE
SQL> show parameter remote_login_passwordfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile string EXCLUSIVE
REMOTE_LOGIN_PASSWORDFILE specifies whether Oracle checks for a password file.
For me password file was missing.
Created password file
orapwd file=$ORACLE_HOME/dbs/orapw<sid> password=<password> force=y ignorecase=n
Bounce database.
Then Oracle sys user database connection with ORACLE_SID is working.
sqlplus sys/manager#dev as sysdba
SQL*Plus: Release 12.1.0.2.0 Production on Thu Nov 25 03:35:47 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

How to revoke alter table permission from user in oracle?

I have a user who only has permission to create dblinks, create session, and manage Scheduler, I want that it will not be able to create any object, delete it or alter it ... I already managed to prevent delete or create new things but I cannot remove the permission to make alters.
try with the following command with another user who has SYSDBA privileges:
REVOKE ALTER ON USER.TEST_LUIS FROM USER;
But the response tells me that I cannot remove permissions that have not been granted.
Any ideas?
Thanks!
You can't revoke alter privilege over objects from the user who owns them. You would need to remove the privilege to create them in the first place.
Example
sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 28 16:14:30 2021
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> drop user test2 cascade ;
User dropped.
SQL> create user test2 identified by Oracle_1234 default tablespace users temporary tablespace temp_group account unlock profile default quota unlimited on users ;
User created.
SQL> grant create session , create table to test2 ;
Grant succeeded.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
sqlplus test2/Oracle_1234
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 28 16:13:24 2021
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> create table t1 ( c1 number ) ;
Table created.
SQL> alter table t1 add ( c2 number ) ;
Table altered.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 28 16:14:30 2021
Version 19.6.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.6.0.0.0
SQL> revoke alter on test2.t1 from test2 ;
revoke alter on test2.t1 from test2
*
ERROR at line 1:
ORA-01927: cannot REVOKE privileges you did not grant
In my example below, I can't revoke the privilege, because the user is the owner of the table.
I can revoke however the create table privilege
SQL> revoke create table from test2 ;
Revoke succeeded.
Alter objects you own is inherited by the create privilege of the same object type.

I am trying to install Apex 5.1 locally but i couldn't connect as a sys user from Apex directory (ERROR: ORA-01031: insufficient privileges)

e:\apex.5\apex_5.1\apex>sqlplus no/log
sql>conn sys as sysdba
ERROR:
ORA-01031: insufficient privileges
so i couldn't continue to the next step of installing Apex.
You should really post what you exactly did, and how Oracle responded.
This is what your code produces in reality:
c:\Temp>sqlplus no/log
SQL*Plus: Release 11.2.0.2.0 Production on Sub Srp 10 13:19:01 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
ERROR:
ORA-01017: invalid username/password; logon denied
That is, you're connecting to user named no whose password is log, and there's no such user (as Oracle responded). I presume you meant to use /nolog, which is something quite different.
Here's how it works on my database:
c:\Temp>sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production on Sub Srp 10 13:17:30 2021
Copyright (c) 1982, 2014, Oracle. All rights reserved.
SQL> conn sys as sysdba
Enter password:
Connected.
SQL>
As you can see, no problem in connecting to the database if I provide valid credentials. I have no idea what you did wrong, because, there are inconsistencies in what you say vs. what you show.
By the way, why installing Apex 5.1. I'd suggest the latest available version (21.1 at the moment).

Unable to create Oracle XE HR sample

I'm completely new to Oracle database and trying to follow steps in the 2 day guide: https://docs.oracle.com/en/database/oracle/oracle-database/21/tdddg/two-day-developer-intro.html
I downloaded an installed the XE database. I am trying to install the HR sample:
https://docs.oracle.com/en/database/oracle/oracle-database/21/comsc/installing-sample-schemas.html#GUID-CB945E4C-D08A-4B26-A12D-3D6D688467EA
However, the script failed. I've tried to narrow down the issue.
I logged in using sqlplus:
>sqlplus "/as sysdba"
and then tried to create a user:
SQL*Plus: Release 18.0.0.0.0 - Production on Tue Mar 16 00:05:06 2021
Version 18.4.0.0.0
Copyright (c) 1982, 2018, Oracle. All rights reserved.
SQL>CREATE USER hr identified by password;
ORA-65096: invalid common user or role name
after this error, I read on another form to try the following:
SQL> alter session set container = XEPDB1;
Session altered.
after the above command, I can create the user:
SQL> create user hr identified by password;
User created.
I also a sent the command:
SQL>GRANT CREATE SESSION TO hr;
Grant succeeded.
But when I try below, I get an error:
SQL>connect hr/password
ERROR:
ORA-01017: invalid username/password; logon denied
Warning: You are no longer connected to ORACLE.
Any ideas? I don't know what I need to do to connect as the hr user.
I was able to connect as follows:
sqlplus hr/password#//localhost:1521/XEPDB1

oracle 11g r2 - deploying dbmsclr.plb as sysdba after ODAC installation

I just finished installing ODTwithODAC112012 on my system. Now I am trying to deploy dbmsclr.plb
But I am getting the error SP2-024 nothing to change.
Here is the command window:-
C:\>sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Tue Aug 14 22:59:39 2012
Copyright (c) 1982, 2010, Oracle. All rights reserved.
SQL> connect sys/Bel29072012 as SYSDBA
Connected.
SQL> C:\app\thoshiba\product\11.2.0\dbhome_1\RDBMS\ADMIN\dbmsclr.plb
SP2-0024: Nothing to change.
SQL> select count(*) from all_objects where object_name='DBMS_CLR';
COUNT(*)
----------
0
SQL> select count(*) from all_objects where object_name='DBMS_CLR' AND owner='SYS';
COUNT(*)
----------
0
SQL>
Please let me know how to overcome this issue.
To gedrid of "SP2-024 nothing to change" error Need to add # before running the script like
SQL> #C:\app\thoshiba\product\11.2.0\dbhome_1\RDBMS\ADMIN\dbmsclr.plb

Resources