본문 바로가기

데이터베이스

Oracle Developer 설치 및 실행 {2023년4월25일}

https://www.oracle.com/database/sqldeveloper/technologies/download/

 

Oracle SQL Developer Downloads

This archive. will work on a 32 or 64 bit Windows OS. The bit level of the JDK you install will determine if it runs as a 32 or 64 bit application. This download does not include the required Oracle Java JDK. You will need to install it if it's not already

www.oracle.com

자신의 환경에 맞게 최신버전 다운로드 하여 알집 풀고 exe파일을 열어 실행하기

아래 형식에 맞게 알맞게 입력을 해야하나 현재 데이터베이스에 user를 생성하지도 않은 상황이므로 데이터베이스에 유저 생성을 해야하는데 그전 단계부터 먼저 진행을 해야한다.

데이터베이스 실행하기

shutdown immediate - 데이터베이스 중단하기

startup - 데이터베이스 시작하기

[oracle@localhost ~]$ ss
# 환경변수 설정에 ss로 sql 실행 path한 상황

SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 25 14:55:48 2023

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  759943168 bytes
Fixed Size                  2217224 bytes
Variable Size             490736376 bytes
Database Buffers          264241152 bytes
Redo Buffers                2748416 bytes
Database mounted.   
Database opened.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

리스너 파일 수정하기

listener.ora 파일과 tnsnames.ora 파일을 수정

[oracle@localhost ~]$ cd $ORACLE_HOME/network/admin
[oracle@localhost admin]$

변경 전 listener.ora 파일

[oracle@localhost admin]$ vi listener.ora

# listener.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /app/oracle

변경 후 listener.ora 파일

# listener.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
# Generated by Oracle configuration tools.


SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =
       (SID_NAME = orcl)
       (ORACLE_HOME = /app/oracle/product/11.2.0/dbhome_2)
     )
   )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.138)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /app/oracle

변경 전 tnsnames.ora 파일

[oracle@localhost admin]$ vi tnsnames.ora
# tnsnames.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_2/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

변경 후 tnsnames.ora 파일

[oracle@localhost admin]$ vi tnsnames.ora
[oracle@localhost admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /app/oracle/product/11.2.0/dbhome_2/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

LISTENER_ORCL =
   (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.138)(PORT = 1521))

ORACLR_CONNECTION_DATA =
    (DESCRIPTION =
        (ADDRESS_LIST =
            (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
        )
        (CONNECT_DATA =
           (SID = CLRExtProc)
           (PRESENTATION = RO)
        )
    )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.138)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

[oracle@localhost admin]$

제대로 적용을 위해 리스너를 종료하였다 다시 실행 시켜줍니다.

 

리스너 실행하기

lsnrctl start - 리스너 시작

lsnrctl stop - 리스너 중지

lsnrctl statu - 리스너 상태확인

[oracle@localhost ~]$ lsnrctl statu

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-APR-2023 14:58:41

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.111.139)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@localhost ~]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-APR-2023 14:58:50

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.111.139)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@localhost ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-APR-2023 14:58:58

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /app/oracle/product/11.2.0/dbhome_2/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
Log messages written to /app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.111.139)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.111.139)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                25-APR-2023 14:58:58
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.111.139)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost ~]$ lsnrctl statu

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 25-APR-2023 14:59:06

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.111.139)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                25-APR-2023 14:58:58
Uptime                    0 days 0 hr. 0 min. 7 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /app/oracle/product/11.2.0/dbhome_2/network/admin/listener.ora
Listener Log File         /app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.111.139)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

데이터베이스 유저 생성

CREATE USER [ID] identified by ["비밀번호"]; - "" <  '!' 절대 명령으로 인해 ""로 문자인식을 시켜준다. 

DROP USER [ID] CASCADE; - ID 및 해당 ID 권한삭제

[oracle@localhost ~]$ ss

SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 25 15:00:05 2023

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

# 아래의 문구에 따라 데이터베이스 실행여부를 확인해볼 수 있다.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> CREATE USER jslee identified by "jslee1111!";

User created.

SQL> GRANT resource, connect, dba to jslee;

Grant succeeded.

SELECT * FROM all_users; - 생성된 모든 유저 확인하기

SQL> select * from all_users;

USERNAME                          USER_ID CREATED
------------------------------ ---------- ------------------
JSLEE                                  88 25-APR-23
SCOTT                                  84 15-AUG-09
OWBSYS_AUDIT                           83 15-AUG-09
OWBSYS                                 79 15-AUG-09
APEX_030200                            78 15-AUG-09
APEX_PUBLIC_USER                       76 15-AUG-09
FLOWS_FILES                            75 15-AUG-09
MGMT_VIEW                              74 15-AUG-09
SYSMAN                                 72 15-AUG-09
SPATIAL_CSW_ADMIN_USR                  70 15-AUG-09
SPATIAL_WFS_ADMIN_USR                  67 15-AUG-09
~
~

이제 Developer에서 로그인을 해보도록 한다. 만약 문제가 발생된다면,

방화벽에 1521 포트를 추가한다.

[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=1521/tcp
success

이후 systemctl restart firewalld 을 해서 방화벽을 재시작 후 확인해본다.

만약 이 마저도 진행이 안된다면,

root에서 systemctl stop firewalld 방화벽을 꺼둔 상황에서 실행 해보는 방법도 하나지만, 정식적으로 텔넷등을 통해 좀더 오라클 실행 전 테스트 하는 방법을 공부해야한다.