Tuesday, September 29, 2009

"conn / as sysdba" on Windows

We can do the following when we want to connect to Oracle db using "conn / as sysdba" in *nix environment:

% export ORACLE_SID=ORCL

% sqlplus /nolog

% conn / as sysdba

Not a big deal. However, I got the following doing the same on Windows XP:

C:\>set ORACLE_SID=ORCL

C:\>sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Sep 29 16:08:51 2009

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

SQL> conn / as sysdba

ERROR:

ORA-12560: TNS:protocol adapter error

After going around for awhile, here is the solution: we need to start the corresponding Oracle services (OracleService) from Control Panel > Administrative Tools > Services. This service automatically starts the database in open state by default. If you want to start in other state, then you need to set ORA_ORCL_AUTOSTART registry value (\HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_orahome102) to FALSE. Here is the screenshot of the registry entry after I changed it:

And here we go again:

C:\>set ORACLE_SID=ORCL

C:\>net start OracleServiceORCL

The OracleServiceORCL service is starting.

The OracleServiceORCL service was started successfully.

C:\>sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Tue Sep 29 16:38:20 2009

Copyright (c) 1982, 2007, Oracle. All Rights Reserved.

SQL> conn / as sysdba

Connected to an idle instance.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 612368384 bytes

Fixed Size 1298168 bytes

Variable Size 289407240 bytes

Database Buffers 314572800 bytes

Redo Buffers 7090176 bytes

Notice that the listener is not even started!

1 Comments:

Anonymous Wayne Stanton said...

Lovely ppost

7/17/2024 1:15 AM  

Post a Comment

<< Home