Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can connect by service name using sqldeveloper, how to connect using sqlplus with sqlplus / as sysdba

I can connect to my database through sql developer as follow:

dsli01@//10.9.xxx.xx:25100/dsli01.unifysoft.com

and in this database, I can run the following select statement:

select * from sli_edtn;

if I run

select instance from v$thread;

it returns orcl

the user account dsli01 has no sysdba right.

I run the following sql to find the current schema

SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL;

and the result is

DSLI01

the database is installed on my linux CentOS Linux 7 (Core)

I want to connect to this database through sqlplus in my linux CentOS, using my root account, and login as sysdba, then grant right to dsli01.

the environment variable is as follow:

declare -x ORACLE_BASE="/u01/app/oracle"
declare -x ORACLE_HOME="/u01/app/oracle/product/12.2.0/dbhome_1"
declare -x ORACLE_SID="orcl"

In linux, I type

su oracle
sqlplus /  as sysdba
[oracle@slis etc]$ sqlplus / sysdba;
SELECT SYS_CONTEXT('USERENV', 'CURRENT_SCHEMA') FROM DUAL;

it return SYS

then I type

SQL> ALTER SESSION SET CURRENT_SCHEMA="DSLI01";
SQL> ALTER SESSION SET CURRENT_SCHEMA="dsli01";

but return

ERROR:
ORA-01435: user does not exist

then I try to run

select * from sli_edtn;

but it returns

ERROR at line 1:
ORA-00942: table or view does not exist
  1. why? it is not connect to the same database as in sqldeveloper dsli01@//10.9.xxx.xx:25100/dsli01.unifysoft.com?
  2. my linux environment variable, ORACLE_SID = orcl, is this correct?
  3. then how can I use sqlplus to connect to 10.9.xxx.xx:25100 serivce name:dsli01.unifysoft.com using my linux CentOS root account ,then grant right to user dsli01?
This post has been answered by Solomon Yakobson on Dec 16 2023
Jump to Answer
Comments
Post Details
Added on Dec 16 2023
7 comments
416 views