0

Oracle database 21c express edition on Windows 11.

enter image description here

My error

ORA-12154: TNS:could not resolve the connect identifier specified

enter image description here

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>

enter image description here

Vy Do
  • 46,709
  • 59
  • 215
  • 313

2 Answers2

1

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.
Vy Do
  • 46,709
  • 59
  • 215
  • 313
Connor McDonald
  • 10,418
  • 1
  • 11
  • 16
  • Thank you. I catch `ERROR: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER` – Vy Do Aug 25 '22 at 03:22
  • That is indeed correct. You almost never need to connect as SYS unless you are doing some serious database admin stuff. If you *do* need to do it, then its "connect abc/edf@db as sysdba". But to create users etc etc, you can connect as SYSTEM and that should be fine. Don't put your OWN objects in SYS or SYSTEM - create your own user for that. eg. https://www.youtube.com/shorts/lb6E_Z5Op6w – Connor McDonald Aug 25 '22 at 03:30
0
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
Vy Do
  • 46,709
  • 59
  • 215
  • 313