How to connect the Database as sysdba in windows
How to connect the Database as sysdba in windows.
DB Version: 19.3.0.0.0
Platform: Windows 11
Step1
Start the command prompt
Step 2
Verify whether DB services are running or not in services.
Step 3
Verify the environment
Set path
Output
Path=C:\app\oracle\product\19c\db_home\bin;C:\Windows\system32;
C:\Windows;C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\; C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\; |
Step 4
Method 1
Do type in command prompt
C:\>Sqlplus “/as sysdba”
SQL> |
After you have connected, to get database name.
Select name from v$database |
Output:
NAME
———- MKTG |
Method 2
C:\> sqlplus /nolog
SQL> conn sys as sysdba SQL> Select name from v$database |
Output:
NAME
———- MKTG |
Scenario:
On the windows server we have both Oracle 19c and 21c versions .
On 19c , Two databases (ORCL,MKTG)created .
On 21c , One database (FIN) created.
Now we want to connect to ORCL database.
Because 21c installed after 19c ,in the path environment variable ,we have values as below. Note that oracle 21c environment set as first.
Path=C:\app\oracle\product\21c\db_home\bin;
C:\app\oracle\product\19c\db_home\bin; C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem; C:\Windows\System32\WindowsPowerShell\v1.0\; |
Method 1:
Step 1
Set the environment
C:\> set ORACLE_SID=ORCL
C:\> cd C:\app\oracle\product\19c\db_home\bin |
Step 2
Connect to 19c database
C:\ app\oracle\product\19c\db_home\bin> .\sqlplus “/as sysdba”
SQL> Select name from v$database |
Output:
NAME
———- ORCL |
Method 2:
Step 1
Set the environment
C:\> set ORACLE_SID=ORCL |
Change the path variable value so that 19c binaries run first.
C:\> set path=C:\app\oracle\product\19c\db_home\bin;%path% |
Step 2
Verifiy the environment
C:\> set path=C:\app\oracle\product\19c\db_home\bin;C:\app\oracle\product\21c\db_home\bin;C:\app\oracle\product\19c\db_home\bin;
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0 |
Step 3
C:\> sqlplus “/as sysdba”
SQL> Select name from v$database |
Output:
NAME
———- ORCL |
See Also: