posted by 빠담아빠다 2016. 3. 6. 01:43

용량이 꽉차서 , Oracle접속이 안될때..지울게 없을때

DB Full


1. 접속 안됨 ( sql developer도 마찬가지 )

[oracle@devdb ~]$ sqlplus / as sysdba


- 시스템 용량 확인.

[oracle@devdb ~]$ df -h

Filesystem Size Used Avail Use% Mounted on

/dev/mapper/VolGroup-lv_root 50G 47G 0G 100% /


- oracle이 설치된 디렉토리가 용량차지.

[root@devdb /]# du -sh /opt

38G /opt


- 데이타 파일 위치 확인

SQL> select name from v$datafile;


NAME

  --------------------------------------------------------------------------------

  /opt/oracle/oradata/devdb/system01.dbf

  /opt/oracle/oradata/devdb/sysaux01.dbf

  /opt/oracle/oradata/devdb/users01.dbf

  /opt/oracle/oradata/devdb/example01.dbf

  /opt/oracle/product/11gr2/dbs/jms.dbf

  /home/oracle/Data/santa15.dbf

  /opt/oracle/product/11gr2/dbs/santa3_1.dbf

  /opt/oracle/oradata/devdb/undotbs02.dbf

2. dbf 파일 이동.

[root@devdb dbs]# ls rlth /opt/oracle/product/11gr2/dbs

total 12G

-rw-r--r- 1 oracle oinstall 2.8K May 15 2009 init.ora

rw-r---- 1 oracle oinstall 24 Apr 19 2013 lkDEVDB

rw-r---- 1 oracle oinstall 1.5K Nov 10 18:53 orapwdevdb

rw-r---- 1 oracle oinstall 9.6G Dec 11 17:58 santa15.dbf

rw-rw--- 1 oracle oinstall 1.6K Dec 12 09:11 hc_devdb.dat

rw-r---- 1 oracle oinstall 769M Dec 12 09:11 jms.dbf

rw-r---- 1 oracle oinstall 1001M Dec 12 09:11 santa3_1.dbf

rw-r---- 1 oracle oinstall 2.5K Dec 12 09:12 spfiledevdb.ora


- 이중에 santa15.dbf 를 /home/oracle/Data 밑으로 카피.

(1) 디렉토리 생성

[oracle@devdb ~]$ mkdir -p /home/oracle/Data

(2) 파일카피

[oracle@devdb ~]$ cp -rp /opt/oracle/product/11gr2/dbs/santa15.dbf /home/oracle/Data/

(3) 리스너 stop / DB shutdown

[oracle@devdb ~]$ lsnrctl stop

[oracle@devdb ~]$ sqlplus / as sysdba

SQL> shutdown immdiate

(4) startup mount

SQL> startup mount

(5) dbf 위치 변경

SQL> alter database rename file '/opt/oracle/product/11gr2/dbs/santa15.dbf' to '/home/oracle/Data/santa15.dbf';

(6) alter database open

SQL> alter database open ;

(7) 변경 확인

SQL> select name from v$datafile;


NAME

  --------------------------------------------------------------------------------

  /opt/oracle/oradata/devdb/system01.dbf

  /opt/oracle/oradata/devdb/sysaux01.dbf

  /opt/oracle/oradata/devdb/users01.dbf

  /opt/oracle/oradata/devdb/example01.dbf

  /opt/oracle/product/11gr2/dbs/jms.dbf

  /home/oracle/Data/santa15.dbf

  /opt/oracle/product/11gr2/dbs/santa3_1.dbf

  /opt/oracle/oradata/devdb/undotbs02.dbf


- /opt/oracle/product/11gr2/dbs/santa15.dbf 파일 삭제.

posted by 빠담아빠다 2016. 3. 6. 01:41

SQL Developer에서 DB 접속이 되지 않을때.

 

 

com # sqlplus / as sysdba

 

SQL > startup

 

 

com # lsnrctl start

 

 

이후에 sqldeveloper 에서 접속이 되지 않을 경우.

...

 

상황 )

 oracle 설치 후 sqldeveloper 설정한 뒤에 테스트하다가. 한참뒤에 재부팅.

 -> 그이후로 17002 에러가 뜨면서 접속이 되지 않음 .

 

 

조치 )

 tnsnames.ora ,  listener.ora 의 호스트 명을 변경.( 변경 전에는 localhost 로 적용이 되어있었다.)

>>listener.ora 파일 내용

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST =호스트명)(PORT = 1521))
    )
  )

 

>>tnsnames.ora 파일 내용

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 호스트명)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = ORCL)
    )
  )

 

내생각)

 기존에 만든 호스트 명이 재부팅을 하면서 바뀌어가지고. 접속이 되지 않았을 가능성이 있다.

 근데 localhost로 하면 되어야 하는게 정상인것 같다... localhost이니까

 

조치 이후 )

오라클 startup

리스너 start

 

 

sql developer 접속 원활히 잘됨. 끝 집 고고

 

'DB > Oracle' 카테고리의 다른 글

[Oracle] System 용량 부족 - oracle DB 접속 에러  (1) 2016.03.06
Oracle 설치 [2/2]  (0) 2016.03.06
Oracle 설치 [1/2]  (0) 2016.03.06
[Query] like and not like  (0) 2016.03.06
posted by 빠담아빠다 2016. 3. 6. 01:34

Oracle 설치

 


posted by 빠담아빠다 2016. 3. 6. 01:33

1.필요 패키지 확인

Setarch와 compat-libstdc++은 없어도 됨.

# rpm -q(a) gcc make binutils openmotif setarch compat-db libaio compat-libstdc++

 

1.유저 추가(계정생성)

groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba oracle
passwd oracle

 

1.디렉토리 생성

mkdir -p /oracle/product/11.2.0/db_1

chown -R oracle:oinstall /oracle

chmod –R 775 /oracle

 

1.IP 설정.

127.0.0.1       localhost.localdomain  localhost

192.168.2.181   oracle

 

1.커널 파라미터 수정

Add or amend the following lines in the "/etc/sysctl.conf" file.

fs.suid_dumpable = 1

fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 536870912

kernel.shmmni = 4096

# semaphores: semmsl, semmns, semopm, semmni

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 9000 65500

net.core.rmem_default=4194304

net.core.rmem_max=4194304

net.core.wmem_default=262144

net.core.wmem_max=1048586

 

1.커널 수정 내역 적용

/sbin/sysctl –p

 

1.오라클 사용자 계정 Shell Limit 설정

Add the following lines to the "/etc/security/limits.conf" file.

oracle              soft    nproc   2047

oracle              hard    nproc   16384

oracle              soft    nofile  4096

oracle              hard    nofile  65536

oracle              soft    stack   10240

 

1./etc/pam.d/login 파일 수정

session required    pam_limits.so

추가.

 

1.Selinux 비활성화

/etc/selinux/config

SELINUX=disabled

 

1.환경변수

Login as the oracle user and add the following lines at the end of the ".bash_profile" file, remembering to adjust them for your specific installation.

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

 

ORACLE_HOSTNAME=ol5-112.localdomain; export ORACLE_HOSTNAME

ORACLE_UNQNAME=DB11G; export ORACLE_UNQNAME

ORACLE_BASE=/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME

ORACLE_SID=DB11G; export ORACLE_SID

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

 

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

 

 

1.설치

Log into the oracle user. If you are using X emulation then set the DISPLAY environmental variable.

DISPLAY=<machine-name>:0.0; export DISPLAY

Start the Oracle Universal Installer (OUI) by issuing the following command in the database directory.

 

su – oracle

 

./runInstaller

 

 

 

7.7 자동실행 설정

 

 

 [root@centos ~]$ vi /etc/oratab

 

 

 

 

1
ora11:/oracle/product/11g:Y

 

  • 맨 마지막의 N을 Y로 변경

 

 

 

 [root@centos ~]$ vi /etc/init.d/dbora

 

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
ORACLE_BASE=/oracle
ORACLE_HOME=$ORACLE_BASE/product/11g
ORACLE_OWNER=oracle
LOG=$ORACLE_HOME/startup.log
touch $LOG
chmod a+r $LOG
chown oracle:oinstall $LOG
 
case "$1" in
    'start')
        date >> $LOG
        echo "Oracle Start Up..." >> $LOG
        su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbstart $ORACLE_HOME >> $LOG 2>$1 &
    ;;
    'stop')
        date >> $LOG
        echo "Oracle Shutdown..." >> $LOG
        su - $ORACLE_OWNER -c $ORACLE_HOME/bin/dbshut $ORACLE_HOME >> $LOG 2>$1 &
    ;;
esac

 

 

 

 

 [root@centos ~]$ chmod +x /etc/init.d/dbora
 [root@centos ~]$ ln -s /etc/init.d/dbora /etc/rc5.d/S99dbora
 [root@centos ~]$ ln -s /etc/init.d/dbora /etc/rc5.d/K11dbora

 

7.8 정상적으로 기동되었는지 확인

 

 

 [oracle@centos ~]$ sqlplus / as sysdba

 SQL*Plus: Release 11.2.0.1.0 Production on Wed Apr 4 23:48:43 2012

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

 Connected to:
 Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
 With the Partitioning, OLAP, Data Mining and Real Application Testing options

 SQL> select instance_name from v$instance;
 INSTANCE_NAME
 ----------------
 ora11
 
 SQL>

 

posted by 빠담아빠다 2016. 3. 6. 01:32

DB쿼리시


like는 or로



not like는 and로