Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
350 views
in Technique[技术] by (71.8m points)

ORA-12560: Tns Protocol Adapter Error + ORA-01034: ORACLE not available

I am trying to run a bat script which should perform the automatic deployment of a database, along with other structures, but I have several problems when I run the file.

I have installed Oracle 19, set my ORACLE_HOME to the folder path and also ORACLE_SID is set to "orcl". I have also started the OracleServiceORCL from services and when I run my bat script, I get more errors:

>>>  STEP 0 => Running prerequisites with dba role user  <<<
_____________________________________________________________
BEGIN dbms_output.put_line('Connected user is '||USER); END;

*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0

The file looks like this:

SET serveroutput on
SET pagesize 5000
SET long 5000
SET pages 500
SET linesize 300
SET echo on
SET serveroutput on
WHENEVER SQLERROR EXIT 

prompt ##########################################
prompt ###### Start deploying SABD project ######
prompt ##########################################
prompt

-- Setting deploy variables
define srcDB_path='C:UsersmihaeladWSOPmainmainsrcdatabase'
define adminSABD='SABDADM'
define userSABD='SABDUSER'
define passAdmSABD='SABDADM'
define passUserSABD='SABDUSER'

prompt _____________________________________________________________
prompt >>>  STEP 0 => Running prerequisites with dba role user  <<<
prompt _____________________________________________________________
SET feedback off
EXECUTE dbms_output.put_line('Connected user is '||USER);
--SET feedback on
@runWithDba.sql
prompt
prompt
SET feedback off;
EXECUTE dbms_lock.sleep(2);
SET feedback on;

connect &&adminSABD/&&passAdmSABD
SET serveroutput on
prompt ______________________________________________
prompt >>>  STEP 1 => Creating SABDADM objects  <<<
prompt ______________________________________________
SET feedback off
EXECUTE dbms_output.put_line('Connected user is '||USER);
SET feedback on
@sabdadm/master.sql

connect &&userSABD/&&passUserSABD
SET serveroutput on
prompt ______________________________________________
prompt >>>  STEP 2 => Creating SABDUSER objects  <<<
prompt ______________________________________________
SET feedback off
EXECUTE dbms_output.put_line('Connected user is '||USER);
SET feedback on
@sabduser/master.sql

exit

and also the error regarding TNS: ORA-12560. I will also provide my listener.ora:

# This is a sample listener.ora that contains the NET8 parameters that are
# needed to connect to an HS Agent

LISTENER =
 (ADDRESS_LIST=
      (ADDRESS=(PROTOCOL=tcp)(HOST=0.0.0.0)(PORT=1521))
 )

SID_LIST_LISTENER=
  (SID_LIST=
      (SID_DESC=
         (SID_NAME=dg4odbc)
         (ORACLE_HOME=C:UsersmihaeladDownloadsWINDOWS.X64_193000_db_home)
         (PROGRAM=dg4odbc)
      )
  )

#CONNECT_TIMEOUT_LISTENER = 0 

and also the tnsnames.ora:

# This is a sample tnsnames.ora that contains the NET8 parameters that are
# needed to connect to an HS Agent

dg4odbc  =
  (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
    (CONNECT_DATA=(SID=dg4odbc))
    (HS=OK)
  ) 

I also tried to set ORACLE_SID with "dg4odbc", as mentioned in the tnsnames, but same errors appeared. Does anyone know what I am doing wrong?

question from:https://stackoverflow.com/questions/65935557/ora-12560-tns-protocol-adapter-error-ora-01034-oracle-not-available

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...