0

I am using oracle on my local machine. i was using predefined databases and schema like scott of sysdba. yesterday i have created a database through database configuration assistant, now i am trying to connect to that new database by putting username and password through sysdba like;

SQL> connect username/password

but it gives

ERROR: ORA-01017: invalid username/password; logon denied;

WARNING: you are no longer connected to ORACLE.

i have tried searching on google and there are many answers but nothing is relevant and didn't solve my problem.

  • how can i connect to that database which i have created ?
  • do i have to make a user for that database through sysdba ?
  • do i have to grant any privileges to access that database ?

please do tell me if i'm missing something as i am a noob on oracle. i need to connect to that database because i have to make tablespaces and users in that database.

PS: I have investigated, and the newly created database exist in sysdba databases.

  • Potential dup of https://stackoverflow.com/questions/27357493/how-to-create-new-database-in-oracle-11g-express-edition – Bob Jarvis - Слава Україні Jul 20 '17 at 16:19
  • 1
    You're leaving a lot unsaid and assumed on this question, I don't know what to suggest to you. First you have said nothing about the actual creation of the database besides "created ... through DBCA". And what does "putting username and password through sysdba" mean? I can't tell if you're confusing "sysdba" and "sqlplus" or if you're actually doing something with "sysdba". Finally telling us "nothing [on google] is relevant" is no help; tell us what you actually did try and what happened. – dcsohl Jul 20 '17 at 16:30
  • @dcsohl thanks for your response, let me make it more clear, i was working on user of sysdba "scott" in my class tasks, everything went good. now i am working on my term project, i decided not to use ''scott's" tables, instead i wanted to create a new database where i make my own tables and schemas ets, and users for that database. so i did this with DBCA. now i have database creted, i have username and password but i'm unable to access that database. – Mehran Khan Jul 20 '17 at 16:33

1 Answers1

1

firstly, connect to SYS schema through command from your OS through

$> sqlplus / as sysdba

( this means to connect to SYS schema, implicitly)

and, then query for if your schema exists through

SQL>select * from dba_users where user_name = 'MYSCHEMA'

if not create one with this command SQL>create user myschema identified by mypasswd; and grant this newly created schema through with this privileges,

SQL>grant connect to myschema;
SQL>grant resource to myschema;
SQL>grant unlimited tablespace to myschema;

Now, you are ready to connect your schema with

SQL> connect myschema/mypasswd@db_sid;

By the way case-sensitivity is not important in oracle provided that you use your names without quotation marks(""). I mean myschema and MYSCHEMA are both same.

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
  • Appreciated.. i have safely created a user. please explain a little about it, "i want to connect to the database xyz which have created recently, and i want to make tables in that database. how can i access that xyz database and accomplish the remaining tasks ? " – Mehran Khan Jul 20 '17 at 16:47
  • @MehranKhan now you are at granting step, anthen may connect thru' connect xyz/pwd@db_sid (where db_sid is in your tnsnames.ora file, mostly it's at ORACLE_HOME/network/admin directory) – Barbaros Özhan Jul 20 '17 at 16:52
  • Everything went good. thanks alot :) i am currently working on it. if i need more help, i would be in touch with you. – Mehran Khan Jul 20 '17 at 16:57
  • @MehranKhan ok brother :) – Barbaros Özhan Jul 20 '17 at 17:02