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:42

[root@redmine2 views]# mysql -u root -p

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 64

Server version: 5.1.73 Source distribution


Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> GRANT ALL PRIVILEGES ON *.* TO root@'192.168.200.143' IDENTIFIED BY 'imsi00' WITH GRANT OPTION;

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:40

1.설치파일

DBD-SQLite-1.42.tar.gz


DBI-1.631.tar.gz


2.설치

 gunzip DB*

 tar -xvf DB*.tar

 

 cd DB*

 make

 make test

 make install

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

rownum 기능이 없는 sqlite3

 

select * from idle

where jobid='4621'

order by time asc

limit 1;

 

 

 

limit 기능이 있다고 함. 굳

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

[sqlite] DBI DBD on linux  (0) 2016.03.06
[sqlite] perl select 쿼리  (0) 2016.03.06
[sqlite] perl 테이블 삭제/생성/인서트  (0) 2016.03.06
[sqlite] 테이블 구조 보기  (0) 2016.03.06
posted by 빠담아빠다 2016. 3. 6. 01:37

1. @ <- 배열에 넣는 방법;

   이게 편함


#!/usr/bin/perl

use strict;
use DBI;

my $dbh = DBI->connect(          
    "dbi:SQLite:dbname=test.db", 
    "",                          
    "",                          
    { RaiseError => 1 },         
) or die $DBI::errstr;

my $sth = $dbh->prepare( "SELECT * FROM Cars LIMIT 5" );  
$sth->execute();
      
my @row;
while (@row = $sth->fetchrow_array()) {
    print "@row\n";
}

$sth->finish();
$dbh->disconnect();



2.  $에 넣어서 @$로 받는 방법

  -> 테스트 하지 않음


#!/usr/bin/perl

use strict;
use DBI;

my $dbh = DBI->connect(          
    "dbi:SQLite:dbname=test.db", 
    "",                          
    "",                          
    { RaiseError => 1 },         
) or die $DBI::errstr;

my $sth = $dbh->prepare("SELECT * FROM Cars LIMIT 5");
$sth->execute();

my $row;
while ($row = $sth->fetchrow_arrayref()) {
    print "@$row[0] @$row[1] @$row[2]\n";
}

$sth->finish();
$dbh->disconnect();


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

[sqlite] DBI DBD on linux  (0) 2016.03.06
[sqlite] rownum 기능 limit 기능으로 구한다.  (0) 2016.03.06
[sqlite] perl 테이블 삭제/생성/인서트  (0) 2016.03.06
[sqlite] 테이블 구조 보기  (0) 2016.03.06
posted by 빠담아빠다 2016. 3. 6. 01:37

#!/usr/bin/perl

use strict;
use DBI;

my $dbh = DBI->connect(          
    "dbi:SQLite:dbname=test.db", 
    "",
    "",
    { RaiseError => 1}
) or die $DBI::errstr;

$dbh->do("DROP TABLE IF EXISTS Cars");
$dbh->do("CREATE TABLE Cars(Id INT PRIMARY KEY, Name TEXT, Price INT)");
$dbh->do("INSERT INTO Cars VALUES(1,'Audi',52642)");
$dbh->do("INSERT INTO Cars VALUES(2,'Mercedes',57127)");
$dbh->do("INSERT INTO Cars VALUES(3,'Skoda',9000)");
$dbh->do("INSERT INTO Cars VALUES(4,'Volvo',29000)");
$dbh->do("INSERT INTO Cars VALUES(5,'Bentley',350000)");
$dbh->do("INSERT INTO Cars VALUES(6,'Citroen',21000)");
$dbh->do("INSERT INTO Cars VALUES(7,'Hummer',41400)");
$dbh->do("INSERT INTO Cars VALUES(8,'Volkswagen',21600)");

$dbh->disconnect();



The above script creates a Cars table and inserts 8 rows into the table.

$dbh->do("CREATE TABLE Cars(Id INT PRIMARY KEY, Name TEXT, Price INT)");

The do() method executes the SQL statements. It combines two method calls, prepare() andexecute() into one single call. The do() method is used for non-select statements.

$dbh->do("INSERT INTO Cars VALUES(1,'Audi',52642)");
$dbh->do("INSERT INTO Cars VALUES(2,'Mercedes',57127)");




출처 : http://zetcode.com/db/sqliteperltutorial/connect/


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

[sqlite] DBI DBD on linux  (0) 2016.03.06
[sqlite] rownum 기능 limit 기능으로 구한다.  (0) 2016.03.06
[sqlite] perl select 쿼리  (0) 2016.03.06
[sqlite] 테이블 구조 보기  (0) 2016.03.06
posted by 빠담아빠다 2016. 3. 6. 01:35
sqlite> pragma table_info(CITY_INFO);
0|CITY_ID|INTEGER|1||0
1|CITY_NAME|TEXT|1||0
2|UPDATE_DATE|TIMESTAMP|0|CURRENT_TIMESTAMP|0

또는

sqlite> select * from sqlite_master where tbl_name='CITY_INFO';
table|CITY_INFO|CITY_INFO|13|CREATE TABLE CITY_INFO
(
CITY_ID INTEGER NOT NULL, 
CITY_NAME TEXT NOT NULL ,
UPDATE_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)




sqlite> pragma table_info(sqlite_master);
0|type|text|0||0
1|name|text|0||0
2|tbl_name|text|0||0
3|rootpage|integer|0||0
4|sql|text|0||0



출처 : http://webkebi.zany.kr:9003/board/bView.asp?bCode=19&aCode=2538

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

[sqlite] DBI DBD on linux  (0) 2016.03.06
[sqlite] rownum 기능 limit 기능으로 구한다.  (0) 2016.03.06
[sqlite] perl select 쿼리  (0) 2016.03.06
[sqlite] perl 테이블 삭제/생성/인서트  (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>