Oracle Database 11g Release 2 Standard Edition, Standard Edition One, and Enterprise Edition 7/13: Patch Set 11.2.0.4 for Linux and Solaris is now available on support.oracle.com. Note: it is a full installation (you do not need to download 11.2.0.1 first)
www.oracle.com
들어갈때마다 페이지 구성이 바뀌는 오라클 홈페이지에서 Oracle Database 11g Release 2 중 Linux x86-64(64비트) 혹은 Linux-x86(32비트)를 다운로드 받습니다.
(Nothing to do 라고 출력이 되면 이미 최신버전으로 다운로드가 되어있는것을 의미합니다.)
** 21.02.02 추가 **
[ 오류 내용 ]
위의 명령어를 실행할때 다음과 같은 오류가 발생할 경우가 있습니다.
YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/arch combination/ removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base YumRepo Error: All mirror URLs are not using ftp, http[s] or file. Eg. Invalid release/repo/arch combination/removing mirrorlist with no valid mirrors: /var/cache/yum/i386/6/base/mirrorlist.txt Error: Cannot find a valid baseurl for repo: base
CentOS6 버전 업데이트 지원이 종료되면서 yum update 등 명령어 사용 시 발생합니다.
이때, 해결방법을 알려드리겠습니다. 32bit, 64bit 에 따라 명령어가 다르니 getconf LONG_BIT명령어를 통해 리눅스의 비트를 확인해주세여!
oracle soft nproc 2048 oracle hard nproc 65536 oracle soft nofile 1024 oracle hard nofile 65536
3) SELINUX 설정을 해제합니다.
[root@localhost ~]# vi /etc/selinux/config
다음과 같이 변경합니다.
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded. SELINUX=disabled
>>>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<< 에러가 날 경우 켜져있는 리눅스 서버를 모두 종료하고 다시 실행해주세요
[oracle@localhost ~]$ cd database
[oracle@localhost database]$ ./runInstaller
[oracle@localhost ~]$ cd /usr/oracle/app/product/11.2.0/dbhome_1/sysman/lib
[oracle@localhost lib]$ vi ins_emagent.mk
아래와 같은 구문을 찾아서
$(SYSMANBIN) emdctl:
$(MK_EMAGENT_NMECTL)
아래와 같이 수정하고 저장합니다.
$(SYSMANBIN) emdctl:
$(MK_EMAGENT_NMECTL) -lnnz11
Retry 버튼을 선택해서 재시도합니다. 잘되는군염
완료될때쯤 쉘 스크립트 실행하라는 안내창이 뜹니다.
하라는대로 따라하면됩니다. 새 창을 열어서 root 계정으로 실행해줍니다.
[root@localhost ~]# /usr/oracle/oraInventory/orainstRoot.sh
Changing permissions of /app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /app/oraInventory to dba.
The execution of the script is complete.
[root@localhost ~]# /usr/oracle/app/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script…
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: [ENTER]키 누르세용
Copying dbhome to /usr/local/bin …
Copying oraenv to /usr/local/bin …
Copying coraenv to /usr/local/bin …
Creating /etc/oratab file…
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
※ netca command not found 웅앵웅 에러 뜰 경우 다음과 같은 명령어를 실행하세염
위에서 환경변수가 적용이 안되었거나 오라클이 설치된 path가 잘못될 경우 나타납니다.
[oracle@localhost ~]$ cd /app/oracle/product/11.2.0/dbhome_1/bin
[oracle@localhost ~]$ ./netca
Listener configuration 체크 후 Next
최초 구성이므로 Add 선택 후 Next
아묻따 Next
확인 후 넥스트
오라클 기본포트 1521 확인 후 넥스트
다른 리스터 추가 할거니? 아니 > 넥스트
끝났당 ㄴㅅㅌ
Finish 선택해서 창 종료
6. 데이터베이스 생성
다음 명령어로 데이터베이스를 생성합니다.
[oracle@localhost ~]$ dbca
생성시작 Next
Create a Database 선택하고 Next
웅웅 알겠어염 확인하구 Next
ORACLE SID를 orcl로 설정하고 넥스트
(SID를 orcl 말고 다른걸로 변경하고 싶으면 .bash_profile의 ORACLE_SID 변수 값도 변경해주어야해여)
고대로 넥스트
관리자 전체 계정에 동일 패스워드를 사용한다는 옵션 체크 후 패스워드 설정
(까먹으면 귀찮아지니까 쉬운걸로 설정하세염)
패스워드를 단순하게 설정하면 뜨는 확인창임다 Yes를 선택해서 무시하고 넘어가시져
넥스트
ㄴㅅㅌ
ㄴㅅㅌ
서버 메모리 사양에 따라 설정된 값임다 그대로 설정하고 [Sizing] 탭을 선택해주세여
확인하고 [Character Sets] 탭 선택하세여
UTF-8이랑 항구거로 설정하고 [Connection Mode] 선택
기본 설정값 고대로 ㄴㅅㅌ
설정된 값 확인하고 ㄴㅅㅌ
피니쉬
마지막으로 설치 전에 확인하고 OK
아래와 같이 설치됩니다
(나만그런가 설치 열라느림)
아래와 같은 창 뜨면 설치 완료된겁니다.
ㅎㅏ,, 이제 모두 설치 완료가 됐습니다.
이제 실행하는 것만 남았군여,,,
7. 데이터베이스 및 리스너 실행
아까 위에서 .bash_profile에 alias로 sysdba로 접속하는 별칭을 주었기 때문에 아래와 같은 명령어로 접속합니다.
[oracle@localhost ~]$ ss
SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 31 13:56:58 2020
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> startup
ORA-01081: cannot start already-running ORACLE – shut it down first
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 768294912 bytes
Fixed Size 2217304 bytes
Variable Size 486541992 bytes
Database Buffers 276824064 bytes
Redo Buffers 2711552 bytes
Database mounted.
Database opened.
SQL > exit
리스너 기동 상태를 확인합니다.
[oracle@localhost ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 – Production on 31-JAN-2020 14:01:07
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=xx.xx.xx.xx)(PORT=1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 – Production
Start Date 30-JAN-2020 17:28:30
Uptime 0 days 20 hr. 32 min. 36 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=xx.xx.xx.xx)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary…
Service “orcl” has 1 instance(s).
Instance “orcl”, status UNKNOWN, has 1 handler(s) for this service…
The command completed successfully
리스너는 lsnrctl start 또는 lsnrctl stop 명령어를 이용해서 끄고 켜고를 할 수 있습니다.
8. 데이터베이스 계정 생성
이제 데이터베이스에 계정을 생성해서 SQLDeveloper에 붙어볼겁니다.
저는 제 티스토리 주소인 xxsiyoung 이름으로 계정을 만들고 권한까지 줘보겠슴다.
참고로 저는 귀찮아서 계정 아디랑 비번을 똑같이 만들어요
밑에 명령어중에 identified by 뒤에는 비밀번호를 설정하는 겁니다.
권한은 데이터베이스 사용하는데 필요한 권한은 다 줬어요
자세한 권한 설명은 구글링 하시기 바랍니다,,
[oracle@localhost ~]# ss
…
SQL> CREATE USER xxsiyoung identified by xxsiyoung;
User created.
SQL> GRANT resource, connect, dba to xxsiyoung;
Grant succeeded.
다음과 같은 명령어로 생성한 계정이 잘 만들어졌는지 확인해주세여
SQL> SELECT * FROM ALL_USERS;
9. SQLDeveloper에 연결하기 (외부접속하기)
이제 생성을 했으면 사용하기 쉽게 SQLDeveloper에 연결할겁니다.
$ORACLE_HOME/network/admin 폴더에 있는 listener.ora 파일과 tnsnames.ora 파일을 수정해주어야 합니다.