블로그 이미지
redkite

카테고리

분류 전체보기 (291)
00.SI프로젝트 산출물 (0)
00.센터 운영 문서 (0)
01.DBMS ============.. (0)
01.오라클 (117)
01.MS-SQL (15)
01.MySQL (30)
01.PostgreSql (0)
01.DB튜닝 (28)
====================.. (0)
02.SERVER ==========.. (0)
02.서버-공통 (11)
02.서버-Linux (58)
02.서버-Unix (12)
02.서버-Windows (2)
====================.. (0)
03.APPLICATION =====.. (11)
====================.. (0)
04.ETC =============.. (0)
04.보안 (5)
====================.. (0)
05.개인자료 (1)
06.캠핑관련 (0)
07.OA관련 (1)
Total
Today
Yesterday

달력

« » 2013.3
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31

공지사항

최근에 올라온 글

# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi


# User specific environment and startup programs


PATH=$PATH:$HOME/bin


export PATH

unset USERNAME


# User specific environment and startup programs

export ORACLE_BASE=/oracle/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/1020/db_1

export ORA_CRS_HOME=$ORACLE_BASE/product/1020/crs_1

export ORACLE_PATH=$ORACLE_BASE/common/oracle/sq1:.:$ORACLE_HOME/rdbms/admin


# Each RAC node must have a unique ORACLE_SID. (i.e. orcl1, orcl2, ...)

#export ORACLE_SID=OTPDB


export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin

export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin

export ORACLE_TERM=xterm

export TNS_ADMIN=$ORACLE_HOME/network/admin

export ORA_NLS10=$ORACLE_HOME/nls/data

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib/usr/lib:/usr/local/lib

export CLASSPATH=$ORACLE_HOME/JRE

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export THREADS_FLAG=native

export TEMP=/tmp

export TMPDIR=/tmp

export DISPLAY=172.16.2.235:0.0

export ORACLE_OWNER=oracle

#export NLS_LANG=AMERICAN_AMERICA.KO16KSC5601

#export NLS_LANG=AMERICAN_AMERICA.US7ASCII

#export NLS_LANG=KOREAN_KOREA.KO16KSC5601

#export LANG=C


# prompt

PS1='[${ORACLE_SID}]'`hostname`':$PWD> '

# alias set

alias dba='sqlplus "/as sysdba"'

alias crs='/oracle/app/oracle/product/crs/bin/crs_stat -t'

umask 022

set -o vi

stty erase 

export EDITOR=vi





#ORACLE_SID


echo "Choose ORACLE_SID (ORACLE Database Name)"


echo


echo "1) TEST OTPDB"


echo "2) TEST RADB"


echo


echo "[1번이나 2번을 선택해주세요]"


 


read insNumber


case ${insNumber} in


     1)


       export ORACLE_SID=OTPDB

       export NLS_LANG=AMERICAN_AMERICA.US7ASCII


       ;;


     2)


       export ORACLE_SID=TESTRA

       export NLS_LANG=AMERICAN_AMERICA.KO16KSC5601


       ;;


     *)


       echo "Not Choosed ORACLE_SID"


       ;;


esac

'02.서버-Linux' 카테고리의 다른 글

[리눅스]CentOS virbr0 NAT disable  (0) 2013.05.08
[리눅스]Find perm 옵션  (0) 2013.04.23
[리눅스]RPM Failed dependencies  (0) 2013.03.28
[리눅스]NDD & TCPDUMP  (0) 2013.03.25
[리눅스]SoftWare RAID10  (0) 2013.03.18
Posted by redkite
, |

[root@dev-ra-dbms ~]# rpm -Uvh --nodeps unixODBC-devel-2.2.11-10.el5.i386.rpm


 

경고: unixODBC-devel-2.2.11-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

준비 중...                  ########################################### [100%]

   1:unixODBC-devel         ########################################### [100%]

'02.서버-Linux' 카테고리의 다른 글

[리눅스]Find perm 옵션  (0) 2013.04.23
[리눅스]멀티 환경변수 case 문 이용  (0) 2013.03.29
[리눅스]NDD & TCPDUMP  (0) 2013.03.25
[리눅스]SoftWare RAID10  (0) 2013.03.18
[리눅스]LVM with Software RAID  (0) 2013.03.18
Posted by redkite
, |

Auto Negotiation OFF시 스피드와 Duplex 모드를 동시에 같이 셋팅 해 주어야 함.

Auto Negotitation Diable 시키는 방법 (일시적)

# ethtool -s eth0 autoneg off

스피드와 duplex를 같이 셋팅하지 않고 위와 같이 명령 내리면, 드라이버가 자동으로 다시 Auto Negotiation을 Enable 시켜 버림.

Auto Negotitation Diable 시키는 방법 (NIC을 죽었다 살리면 다시 auto로 바뀜)

# ethtool -s ethx autoneg off speed 1000 duplex full

ethx에서 x는 이더넷 디바이스 숫자를 의미함. 1Gbps 스피드에 Duplex Mode가 Full-Duplex로 맞춰 주는 것을 의미

Auto Negotitation Diable 시키는 방법 (NIC을 죽었다 살려도 고정으로 하게 하는 방법)

# vi /etc/sysconfig/network-scripts/ifcfg-ethx
ETHTOOL_OPTS="speed 100 duplex full autoneg off"

ifcfg-ethx에서 x는 이더넷 디바이스 숫자를 의미함. ifcfg-ethx를 vi 에디터를 통해 열고, ETHTOOL_OPTS... 이하 문구를 넣어 주면 NIC을 죽였다 살렸을 때도 고정 시킬 수 있음.

몇몇 카드는 ethtool로 동작 하지 않을 때가 있는데, 이럴 때는 mii-tool 유틸리티를 이용한다.

# ethtool eth0 => eth0 상태 보기
Settings for eth0:
Supported ports: [ TP MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full

Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: Twisted Pair
PHYAD: 1
Transceiver: internal
Auto-negotiation: on
Supports Wake-on: puag
Wake-on: g
Link detected: yes


# mii-tool -v eth0 => eth0 상태 보기
eth1: no autonegotiation, 10baseT-HD, link ok

# mii-tool -F 100BaseTx-FD eth0 => eth0 상태 변경(100BaseTx-HD 등...)
불행하게도 위 옵션도 부팅 되면, 모두 풀려 버려, auto negotiation으로 변경 되어 버린다. 부팅 될 때도 수동으로 동작하게 하려면, /etc/rc.local 파일에 
ethtool 문구나 mii-tool 문구를 넣어 준다.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

ethtool -s eth0 speed 100 duplex full autoneg off
mii-tool -F 100baseTx-FD eth1
touch /var/lock/subsys/local


==============================================================================================
Linux

1. 연결상태 확인

mii-tool을 옵션없이 실행하면 랜카드의 속도, duplex 모드, 연경 상태를 보여주며 
-v 옵션을 추가하면 보다 상새한 MII 상태를 볼 수 있다. 
root 권한으로 실행해야 합니다.

--------------------------------------------------------------------------------------- 
# mii-tool 
eth0: negotiated 100baseTx-FD, link ok ( 100MB, Full Duplex로 autonegotiation됨 ) 
eth1: no link             ( 연결되어 있지 않음 ) 
# mii-tool -v 
eth0: negotiated 100baseTx-FD, link ok 
 product info: Intel 82555 rev 4 
 basic mode:  autonegotiation enabled 
 basic status: autonegotiation complete, link ok 
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
 advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control 
 link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
eth1: no link 
 product info: Intel 82555 rev 4 
 basic mode:  autonegotiation enabled 
 basic status: no link 
 capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 
 advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control 
---------------------------------------------------------------------------------------

-w 옵션을 사용하면 실시간으로 연결 상태를 확인할 수 있다. 
만약 갑자기 no link라고 나온다면 회선에 문제가 생겼거나 연결된 장비간의 회선속도나 
duplex 모드가 맞지 않은 경우이다.

--------------------------------------------------------------------------------------- 
# mii-tool -w 
08:58:00 eth0: negotiated 100baseTx-FD, link ok 
08:58:00 eth1: no link 
21:23:11 eth0: no link (연결이 끊긴 상태에서) 
21:23:15 eth0: negotiated 100baseTx-FD, link ok (다시 연결됨) 
---------------------------------------------------------------------------------------

2. 속도 변경

autonegotiation으로 두 장비간의 연결 속도와 duplex 모드를 자동으로 맞추게되지만 
제대로 되지 않아 충돌(Late Collision)이 많이 발생하는 경우나 원하는 속도로 변경을 
해야할 때 mii-tool은 유용하게 쓰일 수 있다. 다음은 100MB, Full duplex 모드로 변경 
하는 예이다.

--------------------------------------------------------------------------------------- 
# mii-tool -F 100baseTx-FD eth0 
---------------------------------------------------------------------------------------

원래 autonegotiation로 restart하려면 -r 옵션을 사용하면 된다.


Solaris

다음 절차는 네트워크 인터페이스 카드가 자동 협상(autonegotiation)이 설정(ON)되어
있는 상태에서 실행하고 있는 경우 100 MB full duplex 또는  원하는 속도와 모드로
강제 설정하는 방법입니다.

1. 서버에서 확인한 결과, 자동 협상(autonegotiation)이 설정(ON)되어 있다면 100fdx
및 100hdx 옵션 모두가 1(ON)을 여러 번 반환하고 10fdx 및 10hdx도 1을 반환합니다. 
따라서 100fdx 또는 1000fdx 변수를 1(ON)로 설정한 경우 다른 설정값은 여전히 활성화된
상태입니다. /etc/rc2.d/S99.. 스크립트가 수행하는 것처럼 다른 모든 옵션을 0으로 
설정해야 합니다. 예를 들어 hme 카드의 경우 명령행에서 다음과 같은 순서대로 옵션을
설정해야 합니다.

ndd -set /dev/hme instance 0 
ndd -set /dev/hme adv_autoneg_cap 0 
ndd -set /dev/hme adv_100T4_cap 0 
ndd -set /dev/hme adv_100fdx_cap 1 
ndd -set /dev/hme adv_100hdx_cap 0 
ndd -set /dev/hme adv_10fdx_cap 0 
ndd -set /dev/hme adv_10hdx_cap 0

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

ifconfig -a로 LAN Card 확인


- NETWORK Parameter 확인. 
==================================== 
ndd -get /dev/eri adv_autoneg_cap 
ndd -get /dev/eri adv_100T4_cap 
ndd -get /dev/eri adv_100fdx_cap 
ndd -get /dev/eri adv_100hdx_cap 
ndd -get /dev/eri adv_10fdx_cap 
ndd -get /dev/eri adv_10hdx_cap 
============================== 
- 수동으로 설정 파일 수정. 
@doc[/etc/rc2.d]#vi S97fdx 
ndd -set /dev/eri adv_autoneg_cap 0 
ndd -set /dev/eri adv_100T4_cap 0 
ndd -set /dev/eri adv_100fdx_cap 1 
ndd -set /dev/eri adv_100hdx_cap 0 
ndd -set /dev/eri adv_10fdx_cap 0 
ndd -set /dev/eri adv_10hdx_cap 0

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

2. 스위치 측에서 확실한 값을 반환하는 유일한 옵션은 lp_autoneg_cap입니다. 그 외의
모든 옵션의 대부분은 언제나 0을 반환합니다. 예를 들어 아래 모든 옵션은 0을 반환
합니다.

ndd -set /dev/hme instance 0 ndd /dev/hme lp_100fdx_cap ndd /dev/hme lp_100hdx_cap ndd /dev/hme lp_10fdx_cap ndd /dev/hme lp_10fdx_cap

어느 정도 도움이 되는 유일한 옵션은 다음과 같습니다.

ndd /dev/hme lp_autoneg_cap

3. 그러므로 인터페이스 카드와 스위치를 설정한 후 사용할 수 있는 최상의 옵션은 
다음과 같습니다.

ndd /dev/hme link_speed (100MB의 경우 1, 10MB의 경우 0) ndd /dev/hme link_mode (full duplex의 경우 1, half duplex의 경우 0)

위 옵션은 통신할 때 사용하고 있는 인터페이스 및 스위치의 속도와 모드를 나타냅니다.


적용 대상:    네트워크 - OS/네트워크 구성, AFO Vertical Team Docs/LAN/WAN/Datacomms 
첨부:         (없음)

4. 솔라리스에서 회선이 연결됐는지 확인하는 방법

  while 1
  ? ndd -get /dev/hme link_status
  ? sleep 1
  ? end
5. 패킷 모니터링을 위한 트래픽 덤프 툴 tcpdump
  
  1) eth0 인터페이스로 오고가는 트래픽 정보를 보여줌(-i eth0 옵션없으면 eth0임)
  
  tcpdump
  
  2) 192.128.1.1 host로 오고가는 또는 제외한 트래픽

  tcpdump host 192.128.1.1
  tcpdump src host 192.128.1.1
  tcpdump dst host 192.128.1.1
  tcpdump not host 192.128.1.1

  3) 192.128.1.1과 192.128.1.2 사이를 오고가는 트래픽만

  tcpdump host 192.128.1.1 and 192.128.1.2

  4) ICMP, ARP, UDP 프로토콜만, ICMP 프로토콜 20개만

  tcpdump icmp -i eth0
  tcpdump arp
  tcpdump udp
  tcpdump icmp -c 20

  5) 웹 포트로 오고가는 패킷만

  tcpdump port 80

  6) dhcp 패킷 확인할 때

  # tcpdump -v -s 1500 port 67 or port 68
  tcpdump: listening on eth0
  01:17:16.803166 0.0.0.0.bootpc > 255.255.255.255.bootps: [udp sum ok]
  xid:0x29b28363 vend-rfc1048 DHCP:REQUEST RQ:truefeel
  PR:SM+BR+TZ+DG+DN+NS+HN+YD+YS+NTP [tos 0x10] (ttl 16, id 0, len 328)
  01:17:16.806441 192.168.1.254.bootps > 255.255.255.255.bootpc:

Posted by redkite
, |


https://www.sulinux.net/bbs/board.php?bo_table=news_2&wr_id=190

 

리눅스 시스템의 점검을 자동 화 하는 툴인 SSU의 업데이트 버전을 다음과 같이 출시했습니다. 많은 관심 바랍니다.


LSCP(Linux System Check Project)는 리눅스 시스템의 보안, 상태, 리소스를 효율적으로 점검하기 위한 프로그램이다.


 

   인터넷이 발달함에 따라 웹서비스의 비중이 커졌으며 웹서버를 구동하는 OS중 반 이상을 리눅스를 사용하고 있다. 그리하여 리눅스를 사용하는 부류들도 전문 리눅스 사용자에서 일반 사용자로 그 분포가 확산되고 있는 실정이다. 이런 일반 사용자는 시스템을 초기 1회 구축 후 방치하게 되는 경우가 대부분이다. 모든 시스템의 가장 중요한 것이 점검 및 백업이다. 백업은 초기 구축으로 자동화 가능하나 점검 부분은 많은 시스템, 하드웨어, 보안 관련 지식을 필요로 하기 때문에 많은 어려움이 따른다. 이 어려운 시스템 점검 부분은 여러 요소로 나뉘며 보안, 시스템 리소스, 시스템 상태를 효율적이고 쉽게 점검 할 수 있는 솔루션이 필요하다. 시스템 자원 사용률을 조사하여 업그레이드시기를 알려주는 시스템 리소스 분석, 시스템 상태를 파악하여 비정상 프로그램 실행 등을 분석하는 시스템 상태 분석, 시스템 접근 및 포트, 프로세스, 파일등 보안요소를 점검하여 해킹 및 공격여부를 미리 알아 낼 수 있는 보안 점검 기능을 가진 리눅스 시스템 점검 프로그램이 필요하다. 이러한 요구사항에 LSCP는 완벽한 해결책을 제시한다.


1.1.1.1. 주요 기능

  1.1.1.1.1. 보안 점검 기능

    - 백도어, Root소유 SetUid파일, tmp 점검

    - LISTEN port 점검

    - Linux 기본 방화벽 점검

    - 실행 프로세스 점검

    - 하루 동안 변경된 파일 점검

    - chkrootkit 이용한 rootkit 점검

    - 초기 실행 스크립트 점검

    - 중요 파일 속성 및 퍼미션 점검

    - 계정 점검

    - 접속자 점검


  1.1.1.1.2. 리소스 점검 기능

    - 부하, 프로세스, 트래픽, 메모리 점검 (그래프)

    - 디스크 파티션 점검 (그래프)

    - cpu 버전, 가동 시간 점검


  1.1.1.1.3. 시스템 상태 점검 기능

    - 용량큰 파일 점검

    - Mail Queue 점검

    - LOG 파일 점검

    - CRON 설정 점검

    - 사용자 정보


  1.1.1.1.4. 문제점 보고

   - 문제점 보고


  1.1.1.1.5. 월간 리포팅 기능(월간 보고서)

    - 하드웨어 정보점검

    - 소프트웨어 정보 점검

    - 네트워크 정보점검

    - 월간 서버 부하 점검

    - 월간 프로세스 수 변화 점검

    - 월간 트래픽 변화량 점검

    - 월간 메모리 사용량 점검

    - 월간 디스크 사용량 점검

    - 기타 정보 점검

    - 사용자 정보 점검


1.1.1.1. 다운로드 

1.1.1.1.1. 다운로드

소스 코드 및 프로그램은 다음 사이트에서 다운로드 할 수 있습니다.

(소스포지에 프로젝트로 등록 완료)

https://sourceforge.net/projects/lscp/


1.1.1.1.2. 기술지원

본 프로그램에 대한 기술지원은 다음 사이트에서 받을 수 있습니다.

( 버그 및 개선점 또한 아래 사이트를 이용하여 제안 바랍니다.)

https://sourceforge.net/tracker/?group_id=260142


1.1.1.2. 설치 전 고려 사항

- 웹서버 : LSCP의 결과는 HTML형태로 출력되지만, 웹 서버는 포함 되어 있지 않다. 그러므로 Apache, tomcat등의 웹서버가 필요하다.

- CRON : LSCP의 주기적인 실행은 CRON의 도움을 받는다. 


1.1.1.3. 라이센스

본 LSCP의 라이센스는 GPL을 따르며, 원문은 소스코드의 COPYING 파일을 참고하거나, 웹사이트(http://www.gnu.org/licenses/)를 참고하길 바란다.


1.1.1. LSCP 설치

1.1.1.1. 프로그램 설치

1.1.1.1.1. 프로그램 다운로드

- 프로젝트 사이트 방문 : https://sourceforge.net/projects/lscp/


 

프로젝트 사이트 방문 후 중간에 “Download Now"를 눌러 프로그램을 다운로드 받는다. 그런 다음 LSCP를 설치 할 리눅스 시스템에 업로드 시킨 후 다음 단계에서 설치한다.


1.1.1.1.2. 프로그램 설치

LSCP 설치는 다음과 같이 Unix 표준 설치법에 따라 진행한다.

tar xvfpj lscp-1.0.0.tar.bz2

cd lscp-1.0.0

./configure --prefix=/usr/local/lscp

make

make install

configure 단계에서 '--prefix' 옵션을 주어 /usr/local/lscp 아래에 프로그램을설치한다. (옵션을 주지 않으면, 기본 /usr/local/ 아래에 프로그램이 설치된다.) 


1.1.1.2. 프로그램 기본 설정

1.1.1.2.1. 설정파일 편집

LSCP는 2개의 설정파일로 이뤄진다. 설정파일의 위치는 설치시 지정한 디렉토리(본 매뉴얼을 따라 설치했다면, /usr/local/lscp가 된다)아래 conf/디렉토리 안에 존재한다.

설정파일 1 : /usr/local/lscp/conf/lscp.conf

설정파일 2 : /usr/local/lscp/conf/lscp_system_files.conf

설정파일 1 ( lscp.conf )

# This file is lscp configuration file.

# Please keep the following format:

# variable="value"

# Variables and the value = the connection, and must not have spaces.

# 사용할 LSCP 모듈 정의

conf_lscp_modules="resource_graph resource_disk backdoor listen_ports firewall status_bigfiles status_mailqueue status_cron status_users process chkrootkit modify_files init_scripts system_files users login_users resource_version status_logfiles error_report report_hw report_sw report_etc report_net"

## Administrator mail address ( 문제점 발생시 받을 메일 주소 입력 )

conf_admin_mail="관리자메일주소입력"

# min big file size(Mbyte) (큰 파일 검색시 최소 파일 크기)

conf_min_big_file_size=50

# max mailqueue count count ( 최대 메일 큐의 메일 수 )

conf_max_mailqueue_count=200

# Apache configuration file ( Apache 설정파일 및 실행 경로 지정 )

conf_httpd_conf="/usr/local/apache/conf/httpd.conf"

conf_httpd_bin="/usr/local/apache/bin"

## LSCP Result Page security ( 보안 설정 )

conf_htauth=yes

conf_htuser="lscp"

conf_htpasswd="sulinux"

# The list of Draw graph process ( max : 5 process) ( 그래프를 그릴 프로세스 )

conf_graph_process="httpd mysql"

# monitor ethernet device ( 그래프를 그릴 네트웍 디바이스 )

conf_graph_eth_dev="eth0"

# check time ( Minute must has 00,05,10 ... 55) ( 매일 점검 할 시간 )

conf_check_time="07:00"

# Archive period ( 점검 결과를 보관 할 일 수 )

conf_archive_period="60"

# safe process lists ( 문제 없는 프로세스 리스트 정의 )

conf_safe_process="awk uptime lscp_cron"

설정파일 1 ( lscp.conf )은 위의 표와 같은 항목이 있다. 모든 옵션은 ‘변수=”값“’과 같은 형식으로 설정한다. 변수와 값 사이에는 ‘=’ 이외의 공백이 들어가면 작동하지 않는다. (예) a ="b" 또는 a= "b" 는 작동하지 않음)


지시자 정의

conf_lscp_modules

LSCP의 여러 기능을 가진 단위 모듈의 사용 여부를 지정한다. 여러 모듈을 열거 할 수 있으며, 모듈과 모듈 사이에는 공백으로 띄워 구분한다.

예) conf_lscp_modules="resource_graph resource_disk"

conf_admin_mail

LSCP에 의해 시스템을 점검 한 결과 문제점이 발생되면, 메일을 보내게 된다. 이 문제점에 대한 내용을 받을 메일 주소를 입력한다.

예) conf_admin_mail="doly@sulinux.net"

conf_min_big_file_size

LSCP 큰 파일 점검 모듈에서 기준으로 사용할 파일 사이즈이다. 명시한 사이즈 이상인 파일만 리스팅 하게 된다. (단뒤: MByte)

예) conf_min_big_file_size=50

conf_max_mailqueue_count

LSCP 메일 큐 점검 모듈에서 기준으로 사용할 메일 큐에 쌓이 메일 수이다. 명시한 수 이상의 메일이 쌓였을 때 점검 문제점 보고에 출력하고, 메일을 발송하게 된다.

예) conf_max_mailqueue_count=200

conf_httpd_conf

LSCP에서 웹서버 설정 도메인 등을 조사하기 위해 아파치 설정파일(httpd.conf)를 사용한다. 이 httpd.conf파일의 위치를 지정한다.

예) conf_httpd_conf="/usr/local/apache/conf/httpd.conf"

conf_httpd_bin

웹서버(아파치)의 실행프로그램 경로를 지정한다.

예) conf_httpd_bin="/usr/local/apache/bin"

conf_htauth

웹서버(아파치)의 페이지 보안 설정기능을 사용하여 웹페이지 접근을 통제를 할 것인지 여부를 결정한다. ( 입력 값 : yes 또는 no )

예) conf_htauth=yes

conf_htuser

웹서버(아파치)의 페이지 보안 설정기능을 사용한다면(conf_htauth=yes) 인증할 사용자를 설정한다.

예) conf_htuser="lscp"

conf_htpasswd

웹서버(아파치)의 페이지 보안 설정기능을 사용한다면(conf_htauth=yes) 인증할 사용자의 비밀번호를 설정한다.

예) conf_htpasswd="sulinux"

conf_graph_process

LSCP 자원 그래프 모듈에서 프로세스 수를 그래프로 보여준다. 그래프에서 보여줄 프로세스 종류를 선택한다. 프로세스는 여러개 그릴 수 있으며, 공백으로 구분하여 열거한다. (최대 5개)

예) conf_graph_process="httpd mysql"

conf_graph_eth_dev

LSCP 자원 그래프 모듈에서 이더넷 인터페이스에 대한 트래픽을 그래프로 그린다. 리눅스 시스템에는 있는 여러 인터페이스 중 그래프를 그릴 디바이스를 선택하기 위해 본 지시자를 사용한다.

예) conf_graph_eth_dev="eth0"

conf_check_time

LSCP는 cron에 의해 5분에 1회 실행된다. 시스템의 전반적인 상황은 매 분 점검하게 되면, 시스템에 많은 부하를 주게 된다. 시스템 전반적인 점검은 하루에 1회 수행한다. 수행하는 시간을 설정하는 지시자이다.

예) conf_check_time="07:00"

conf_archive_period

LSCP는 매일 전반적으로 시스템을 점검하게 된다. 이 점검 된 결과는 시간이 지나서 필요할 때가 있다. 그렇지만, 너무 많이 남게 되면, 많은 디스크 공간을 필요로 하기 때문에 주기적으로 지워주는 것이 필요하다. 본 지시자를 사용하여 점검 결과를 보관할 기간을 정할 수 있다.

예) conf_archive_period="60"

conf_safe_process

LSCP의 실행 프로세스 점검기능에서 안전한 프로세스가 수상한 프로세스로 오탐하는 경우가 있다. 이러한 경우 안전한 프로세스 명을 넣어 줄 수 있는 지시자이다.

예) conf_safe_process="awk uptime lscp_cron"

설정파일 2 ( lscp_system_files.conf )

# This file is lscp configuration file(system file list for lscp_mod_system_files)

# Please keep the following format:

# /path/files

/bin/chgrp

/bin/chmod

/bin/chown

/bin/cp

/bin/df

## 중간 생략 ##

/usr/bin/passwd

/usr/bin/pstree

/usr/bin/ssh

/usr/bin/top

/usr/bin/w

/usr/bin/wget

/usr/bin/who

/usr/sbin/lsof

/usr/sbin/sendmail

설정파일 2 (lscp_system_files.conf)는 시스템의 중요한 파일을 열거해 ‘중요파일 점검’시 점검하게 될 항목들을 명시한다.

⋇ 설정 변경 후에는 lscp_init 을 실행한다.


1.1.1.1.1. 점검 DB 초기화

LSCP 설치 후 초기에 각 리눅스 시스템의 초기 정보를 저장하게 된다. 다음 명령어를 사용하여 저장한다.

명령어 위치 : 프로그램설치경로/bin/lscp_init

예) /usr/local/lscp/bin/lscp_init

[root@sul2-64bit bin]# ./lscp_init

1. 초기화중 lscp_mod_resource_graph ..... [ 활동 없음 ]

2. 초기화중 lscp_mod_resource_disk ..... [ 확인 ]

3. 초기화중 lscp_mod_backdoor ..... [ 확인 ]

4. 초기화중 lscp_mod_listen_ports ..... [ 확인 ]

5. 초기화중 lscp_mod_firewall ..... [ 확인 ]

6. 초기화중 lscp_mod_status_bigfiles ..... [ 활동 없음 ]

7. 초기화중 lscp_mod_status_mailqueue ..... [ 활동 없음 ]

8. 초기화중 lscp_mod_status_cron ..... [ 활동 없음 ]

9. 초기화중 lscp_mod_status_users ..... [ 활동 없음 ]

10. 초기화중 lscp_mod_process ..... [ 확인 ]

11. 초기화중 lscp_mod_chkrootkit ..... [ 확인 ]

12. 초기화중 lscp_mod_modify_files ..... [ 활동 없음 ]

13. 초기화중 lscp_mod_init_scripts ..... [ 확인 ]

14. 초기화중 lscp_mod_system_files ..... [ 확인 ]

15. 초기화중 lscp_mod_users ..... [ 활동 없음 ]

16. 초기화중 lscp_mod_login_users ..... [ 활동 없음 ]

17. 초기화중 lscp_mod_resource_version ..... [ 활동 없음 ]

18. 초기화중 lscp_mod_status_logfiles ..... [ 활동 없음 ]

19. 초기화중 lscp_mod_error_report ..... [ 활동 없음 ]

20. 초기화중 lscp_mod_report_hw ..... [ 활동 없음 ]

21. 초기화중 lscp_mod_report_sw ..... [ 활동 없음 ]

22. 초기화중 lscp_mod_report_etc ..... [ 활동 없음 ]

23. 초기화중 lscp_mod_report_net ..... [ 활동 없음 ]


1.1.1.1.2. 웹서버 설정

LSCP는 점검 결과를 HTML형태로 출력하며, 웹서버의 도움을 받아 웹으로 보여주게 된다. 웹 서버 설정은 다음과 같이 한다.

아파치(Apache) 웹서버

설정파일(httpd.conf)파일을 열어 다음과 같이 가상호스트에 추가한다.

( Apache 2.2.x의 경우는 extra/httpd-vhosts.conf에 설정한다.)

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot /usr/local/lscp/result_html

ServerName lscp.도메인

<Directory /usr/local/lscp/result_html>

AllowOverride AuthConfig

</Directory>

</VirtualHost>

위와 같이 서브 도메인을 할당하여 설정한다.

⋇ 설정 변경 후에는 웹서버를 재시작 한다.

⋇ 웹서버의 종류 및 버전에 따라 설정법은 차이가 있으니, 각 웹서버 매뉴얼을 참조 하기 바란다.


1.1.1. 사용법 ( 점검 결과 확인 )

1.1.1.1. 초기 점검 결과 확인

LSCP 프로그램 설치 후 바로, 결과 페이지를 확인하지는 못한다. 이유는 리눅스 시스템 점검 프로그램이기 때문에 점검을 수행하거나, 정보를 수집하여 보여주기 때문이다. 프로그램 설치 후 5분 이내에 접속하게 되면, 아무런 페이지 및 결과를 확인할 수 없으며, 5분이 지난 후 다음과 같이 확인된다.

1.1.1.1.1. 사용자 인증

LSCP 결과를 아무나보지 못하게 lscp.conf 설정에서 htauth를 사용하게 설정하였다면, 다음과 같은 아이디/비밀번호 입력창이 뜰 것이다.


 

사용자 이름 및 암호를 lscp.conf 설정된 값을 입력하면 다음 화면을 만나게 된다.

1.1.1.1.2. LSCP 메인 화면

LSCP를 처음 설치하고, 결과를 확인하면 다음과 같은 결과를 보게 될 것이다.


 

위 점검 결과는 시스템의 부하만을 볼 수 있으며, 다른 점검결과를 볼 수 없다. 이는 시스템의 전반적 점검이 수행되지 않아서 이며, 좌측 상단의 “점검항목”에 보여지는 명령어를 다음과 같이 수행한다.

[root@sul2-64bit result_html]# cd /usr/local/lscp/bin

[root@sul2-64bit bin]# ./lscp_cron --check

1. 점검중 lscp_mod_resource_graph ..... [ 활동 없음 ]

2. 점검중 lscp_mod_resource_disk ..... [ 확인 ]

3. 점검중 lscp_mod_backdoor ..... [ 확인 ]

4. 점검중 lscp_mod_listen_ports ..... [ 확인 ]

5. 점검중 lscp_mod_firewall ..... [ 확인 ]

6. 점검중 lscp_mod_status_bigfiles ..... [ 확인 ]

7. 점검중 lscp_mod_status_mailqueue ..... [ 확인 ]

8. 점검중 lscp_mod_status_cron ..... [ 확인 ]

9. 점검중 lscp_mod_status_users ..... [ 확인 ]

10. 점검중 lscp_mod_process ..... [ 확인 ]

11. 점검중 lscp_mod_chkrootkit ..... [ 확인 ]

12. 점검중 lscp_mod_modify_files ..... [ 확인 ]

13. 점검중 lscp_mod_init_scripts ..... [ 확인 ]

14. 점검중 lscp_mod_system_files ..... [ 확인 ]

15. 점검중 lscp_mod_users ..... [ 확인 ]

16. 점검중 lscp_mod_login_users ..... [ 확인 ]

17. 점검중 lscp_mod_resource_version ..... [ 확인 ]

18. 점검중 lscp_mod_status_logfiles ..... [ 확인 ]

19. 점검중 lscp_mod_error_report ..... [ 메뉴 생성 안함 ]

20. 점검중 lscp_mod_report_hw ..... [ 메뉴 생성 안함 ]

21. 점검중 lscp_mod_report_sw ..... [ 메뉴 생성 안함 ]

22. 점검중 lscp_mod_report_etc ..... [ 메뉴 생성 안함 ]

23. 점검중 lscp_mod_report_net ..... [ 메뉴 생성 안함 ]

위 명령어 수행 후 다음과 같은 결과를 확인 할 수 있다.


 

위 결과와 같이 좌측 상단에 “점검항목”이 표시되는 것을 확인 할 수 있다.

“월간보고” 기능역시 명령어를 실행 시켜 결과를 확인 할 수 있다.

 

'04.보안' 카테고리의 다른 글

[보안]LDAP을 이용한 통합계정관리  (0) 2012.12.19
[보안]Radius 서버 구축 관련 자료  (0) 2012.12.19
[보안]Syn Flooding 공격 대응  (0) 2012.12.19
[보안]웹쉘 대응방법  (0) 2012.12.19
Posted by redkite
, |

Step 1: Setup SSH Server in Windows with freeSSHd

This is an absolute noob guide , so I’ll explain in detail. If you are an advanced user (boo!), you are welcome to skip the installation steps.

1- freeSSHd is the easiest software to use to get SSH working in Windows. Download freeSSHd before proceeding any further.

2- Double click the freeSSHd installer that you have downloaded to get started.

freesshd-windows-ssh-server

3- Click Next -> Click Next (or you can change the default installation directory) -> Click Next (Full Installation) -> Click Next (Start Menu Folder) -> Click Next (Create a desktop icon) -> Click Install (ready to install) -> Wait until installation has been finished -> Click Close (Try other products…)

setup-freesshd-first-screen

4- “Do you want to run freeSSHd as a system service?” I choose “No” so I can start freeSSHd manually. This is a good security practice because you don’t want to have running applications in the background if you are not using it. Only turn freeSSHd on when the need for remote connections arise!

start-ssh-as-system-service-option

5- Click Finish to complete freeSSHd installation.

Step 2: Run freeSSHd

6- Double click the freeSSHd icon on the desktop to load your SSH server. You can see the freeSSHd icon on your system tray.

7- Right click on the icon and click Settings.

go-to-freesshd-settings

8- Make sure that the freeSSHd settings page (Server Settings tab) shows that your “SSH server is running”.

check-running-freesshd-server

Step 3: Create a New SSH User

9- Click on the Users tab. You need to create at least one user account that will act as your SSH remote user account.

add-ssh-users

10- Click “Add” to create a new user. Fill in the user details, following the example shown below (with your own unique username and password, duh!). Click OK and make sure it appear on the Users tab list.

ssh-users-created

Step 4: Test SSH Access with Putty (Local)

11- Using the same computer that you install freeSSHd previously, download Putty. Putty is a desktop command line client that you can use to access SSH servers.

12- Double click the Putty installer to run it. Fill in the details as shown in the diagram below. 127.0.0.1 means that you are testing the SSH access from a local connection.

test-ssh-with-putty

13- Press “Yes” on the security alert screen. Insert your SSH username and password that you have created previously.

accept-sha-key-putty

test-ssh-with-putty-2

14- If you get a Windows command prompt, you have successfully access your SSH server! Congratulations!

test-ssh-with-putty-3

15- Connect your computer to the Internet / local network and take note of your computer’s IP address.

Step 5: Test SSH Access with Putty (Remote)

16- Using another computer e.g. your office computer, download Putty again.

17- Repeat step 12 to 13 above but this time, use your SSH server IP address (type it inside Host Name or IP Address field).

18- If you get a Windows command prompt, you have successfully access your SSH server from a remote computer! Double congrats to you!

test-ssh-with-putty-4 

 

 

Access Denied

 

1. setting as NT Authentication
2. Apply
3. Rightclick on the freeSSHd icon in the systray and select “unload”
4. Restart the Service using Windows Services (Start Menu –> Administrative Tools –> Services)

 

'02.서버-Windows' 카테고리의 다른 글

[Windows]윈도우즈 관리 팁  (0) 2012.12.19
Posted by redkite
, |

fdisk on all device and create Software RAID partition same size (E.g. 500GB). For RAID 10 you need to 4 disks. I'm assuming that server is booting from ssd or ide disk called /dev/sda

Code:

fdisk /dev/sdb
fdisk /dev/sdc
fdisk /dev/sdd
fdisk /dev/sde

At this point you may need to reboot the system so that kernel will update and sync table. Once rebooted type the following command to create the mdadm RAID set using 4 paritions:

Code:

mdadm --create /dev/md0 -v --raid-devices=4  --level=raid10 /dev/sdb1 /dev/sdc1 /dev/sde1 /dev/sde1

Watch raid building process

Code:

watch cat /proc/mdstat

Once completed format and use /dev/md0:

Code:

fdisk /dev/md0

Format as ext3 or ext4

Code:

mkfs.ext3 /dev/md0p1

OR

Code:

mkfs.ext4 /dev/md0p1

Mount it:

Code:

mkdir /data
mount /dev/md0p1 /data
Posted by redkite
, |

What is RAID and LVM

RAID is usually defined as Redundant Array of Inexpensive disks. It is normally used to spread data among several physical hard drives with enough redundancy that should any drive fail the data will still be intact. Once created a RAID array appears to be one device which can be used pretty much like a regular partition. There are several kinds of RAID but I will only refer to the two most common here.

The first is RAID-1 which is also known as mirroring. With RAID-1 it's basically done with two essentially identical drives, each with a complete set of data. The second, the one I will mostly refer to in this guide is RAID-5 which is set up using three or more drives with the data spread in a way that any one drive failing will not result in data loss. The Red Hat website has a great overview of the RAID Levels.

There is one limitation with Linux Software RAID that a /boot partition can only reside on a RAID-1 array.

Linux supports both several hardware RAID devices but also software RAID which allows you to use any IDE or SCSI drives as the physical devices. In all cases I'll refer to software RAID.

LVM stands for Logical Volume Manager and is a way of grouping drives and/or partition in a way where instead of dealing with hard and fast physical partitions the data is managed in a virtual basis where the virtual partitions can be resized. The Red Hat website has a great overview of the Logical Volume Manager.

There is one limitation that a LVM cannot be used for the /boot.


Initial set of a RAID-5 array
I recommend you experiment with setting up and managing RAID and LVM systems before using it on an important filesystem. One way I was able to do it was to take old hard drive and create a bunch of partitions on it (8 or so should be enough) and try combining them into RAID arrays. In my testing I created two RAID-5 arrays each with 3 partitions. You can then manually fail and hot remove the partitions from the array and then add them back to see how the recovery process works. You'll get a warning about the partitions sharing a physical disc but you can ignore that since it's only for experimentation.

In my case I have two systems with RAID arrays, one with two 73G SCSI drives running RAID-1 (mirroring) and my other test system is configured with three 120G IDE drives running RAID-5. In most cases I will refer to my RAID-5 configuration as that will be more typical.

I have an extra IDE controller in my system to allow me to support the use of more than 4 IDE devices which caused a very odd drive assignment. The order doesn't seem to bother the Linux kernel so it doesn't bother me. My basic configuration is as follows:

hda 120G drive
hdb 120G drive
hde 60G boot drive not on RAID array
hdf 120G drive
hdg CD-ROM drive
The first step is to create the physical partitions on each drive that will be part of the RAID array. In my case I want to use each 120G drive in the array in it's entirety. All the drives are partitioned identically so for example, this is how hda is partitioned:
Disk /dev/hda: 120.0 GB, 120034123776 bytes
16 heads, 63 sectors/track, 232581 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1      232581   117220792+  fd  Linux raid autodetect
So now with all three drives with a partitioned with id fd Linux raid autodetect you can go ahead and combine the partitions into a RAID array:
# /sbin/mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 \
	/dev/hdb1 /dev/hda1 /dev/hdf1
Wow, that was easy. That created a special device /dev/md0 which can be used instead of a physical partition. You can check on the status of that RAID array with the mdadm command:
# /sbin/mdadm --detail /dev/md0
        Version : 00.90.01
  Creation Time : Wed May 11 20:00:18 2005
     Raid Level : raid5
     Array Size : 234436352 (223.58 GiB 240.06 GB)
    Device Size : 117218176 (111.79 GiB 120.03 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Fri Jun 10 04:13:11 2005
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 64K

           UUID : 36161bdd:a9018a79:60e0757a:e27bb7ca
         Events : 0.10670

    Number   Major   Minor   RaidDevice State
       0       3        1        0      active sync   /dev/hda1
       1       3       65        1      active sync   /dev/hdb1
       2      33       65        2      active sync   /dev/hdf1
The important lines to see are the State line which should say clean otherwise there might be a problem. At the bottom you should make sure that the State column always says active sync which says each device is actively in the array. You could potentially have a spare device that's on-hand should any drive should fail. If you have a spare you'll see it listed as such here.

One thing you'll see above if you're paying attention is the fact that the size of the array is 240G but I have three 120G drives as part of the array. That's because the extra space is used as extra parity data that is needed to survive the failure of one of the drives.


Initial set of LVM on top of RAID
Now that we have /dev/md0 device you can create a Logical Volume on top of it. Why would you want to do that? If I were to build an ext3 filesystem on top of the RAID device and someday wanted to increase it's capacity I wouldn't be able to do that without backing up the data, building a new RAID array and restoring my data. Using LVM allows me to expand (or contract) the size of the filesystem without disturbing the existing data.

Anyway, here are the steps to then add this RAID array to the LVM system. The first command pvcreate will "initialize a disk or partition for use by LVM". The second command vgcreate will then create the Volume Group, in my case I called it lvm-raid:

# pvcreate /dev/md0
# vgcreate lvm-raid /dev/md0
The default value for the physical extent size can be too low for a large RAID array. In those cases you'll need to specify the -s option with a larger than default physical extent size. The default is only 4MB as of the version in Fedora Core 5. The maximum number of physical extents is approximately 65k so take your maximum volume size and divide it by 65k then round it to the next nice round number. For example, to successfully create a 550G RAID let's figure that's approximately 550,000 megabytes and divide by 65,000 which gives you roughly 8.46. Round it up to the next nice round number and use 16M (for 16 megabytes) as the physical extent size and you'll be fine:
# vgcreate -s 16M <volume group name>
Ok, you've created a blank receptacle but now you have to tell how many Physical Extents from the physical device (/dev/md0 in this case) will be allocated to this Volume Group. In my case I wanted all the data from /dev/md0 to be allocated to this Volume Group. If later I wanted to add additional space I would create a new RAID array and add that physical device to this Volume Group.

To find out how many PEs are available to me use the vgdisplay command to find out how many are available and now I can create a Logical Volume using all (or some) of the space in the Volume Group. In my case I call the Logical Volume lvm0.

# vgdisplay lvm-raid
	.
	.
   Free  PE / Size       57235 / 223.57 GB
# lvcreate -l 57235 lvm-raid -n lvm0
In the end you will have a device you can use very much like a plain 'ol partition called /dev/lvm-raid/lvm0. You can now check on the status of the Logical Volume with the lvdisplay command. The device can then be used to to create a filesystem on.
# lvdisplay /dev/lvm-raid/lvm0 
  --- Logical volume ---
  LV Name                /dev/lvm-raid/lvm0
  VG Name                lvm-raid
  LV UUID                FFX673-dGlX-tsEL-6UXl-1hLs-6b3Y-rkO9O2
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                223.57 GB
  Current LE             57235
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:2
# mkfs.ext3 /dev/lvm-raid/lvm0
	.
	.
# mount /dev/lvm-raid/lvm0 /mnt
# df -h /mnt
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/lvm--raid-lvm0
                       224G   93M  224G   1% /mnt

Handling a Drive Failure
As everything eventually does break (some sooner than others) a drive in the array will fail. It is a very good idea to run smartd on all drives in your array (and probably ALL drives period) to be notified of a failure or a pending failure as soon as possible. You can also manually fail a partition, meaning to take it out of the RAID array, with the following command:
# /sbin/mdadm /dev/md0 -f /dev/hdb1
mdadm: set /dev/hdb1 faulty in /dev/md0

Once the system has determined a drive has failed or is otherwise missing (you can shut down and pull out a drive and reboot to similate a drive failure or use the command to manually fail a drive above it will show something like this in mdadm:

# /sbin/mdadm --detail /dev/md0
     Update Time : Wed Jun 15 11:30:59 2005
           State : clean, degraded
  Active Devices : 2
 Working Devices : 2
  Failed Devices : 1
   Spare Devices : 0
	.
	.
     Number   Major   Minor   RaidDevice State
        0       3        1        0      active sync   /dev/hda1
        1       0        0        -      removed
        2      33       65        2      active sync   /dev/hdf1
You'll notice in this case I had /dev/hdb fail. I replaced it with a new drive with the same capacity and was able to add it back to the array. The first step is to partition the new drive just like when first creating the array. Then you can simply add the partition back to the array and watch the status as the data is rebuilt onto the newly replace drive.
# /sbin/mdadm /dev/md0 -a /dev/hdb1
# /sbin/mdadm --detail /dev/md0
     Update Time : Wed Jun 15 12:11:23 2005
           State : clean, degraded, recovering
  Active Devices : 2
 Working Devices : 3
  Failed Devices : 0
   Spare Devices : 1

          Layout : left-symmetric
      Chunk Size : 64K

  Rebuild Status : 2% complete
	.
	.
During the rebuild process the system performance may be somewhat impacted but the data should remain in-tact.
Posted by redkite
, |

오라클 설치시 인스톨러에서 데이타베이스 자동 생성을 할 경우
OS 언어에 따라 자동으로 characterset 이 설정되어 설치되는데,
characterset을 임의로 변경하는 방법 입니다.

변경시나리오)

* 기존 개발용 오라클DB OLD_ORA 의 nls_characterset 은 US7ASCII 이다.

* 기존 클라이언트 nls_lang 은 AMERICAN_AMERICA.US7ASCII 이다.

* 새로운 한글windows OS에 오라클DB NEW_ORA 를 설치하였는데 nls_characterset 이 KO16MSWIN949 이다.

* OLD_ORA 의 데이타를 exp 유틸로 덤프를 떠서 NEW_ORA 에 imp 유틸로 복구하였는데,

일본및 중국 언어문자셋이 깨어져 버리고 ??? 등으로 바뀌어 유니크인덱스가 생성되지 않는다.

* 데이타 이전및 개발호환을 위해 nls_characterset 을 맞추기로 하였다.

새로 설치하지 않고 바꾸는 법 입니다.

절차 SQL> SHUTDOWN IMMEDIATE;
<만일의 사태를 대비해 풀백업을 한다>
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> ALTER DATABASE CHARACTER SET US7ASCII;
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;

ALTER DATABASE CHARACTER SET US7ASCII 변경할때

큰집합이여야 된다는(superset) 등의 에러메세지 떨어질 경우
update SYS.PROPS$ set value$='US7ASCII' where name='NLS_CHARACTERSET';
shutdown immediate;
startup;

클라이언트 nls_characterset 셋팅 :
regedit
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1
- NLS_LANG = AMERICAN_AMERICA.US7ASCII

[nls 환경보기]
--DB
SELECT * FROM nls_database_parameters
WHERE parameter='NLS_CHARACTERSET' OR parameter='NLS_LANGUAGE'

-- session
SELECT * FROM v$nls_parameters

===============================================================================================

위와 같이 설정후 OLD_ORA 데이타 덤프를 NEW_ORA 로 Import 시킨후 한글이 정상적으로 들어와 졌습니다.

그런데 SQLTools,토드 등으로 접속후 객체브라우져로 객체 리스트 보기에서 아래와 같은 에러가 발생하면서

ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-553: character set name is not recognized

객체리스트가 보이지 않았습니다.

원인) 아래 쿼리를 날렸을때 데이터 타입이 중복되어서 나옴

쿼리)

select distinct(nls_charset_name(charsetid)) CHARACTERSET,
decode(type#, 1, decode(charsetform, 1, 'VARCHAR2', 2, 'NVARCHAR2','UNKOWN'),
9, decode(charsetform, 1, 'VARCHAR', 2, 'NCHAR VARYING', 'UNKOWN'),
96, decode(charsetform, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN'),
112, decode(charsetform, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')) TYPES_USED_IN
from sys.col$ where charsetform in (1,2) and type# in (1, 9, 96, 112)

order by types_used_in;

결과)

CHARACTERSET TYPES_USED_IN
------------------------------ -------------
KO16MSWIN949 CHAR
US7ASCII CHAR
KO16MSWIN949 CLOB
US7ASCII CLOB
AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
KO16MSWIN949 VARCHAR2
US7ASCII VARCHAR2

CHAR,CLOB,VARCHAR2 에 중복된 CHARACTERSET이 존재함.

위와 같은 경우 다음과 같이 조취합니다.

조치2) sysdba로 아래 구문들 실행

주의사항)

a) Make sure the parallel_server parameter in INIT.ORA is set to false or it is not set at all.
b) Run the next script in SQLPLUS connected "as sysdba"

SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER DATABASE OPEN;
SQL> COL VALUE NEW_VALUE CHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';
SQL> COL VALUE NEW_VALUE NCHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET;
SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET;
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;
-- yes, 2 times startup/shutdown . This is not a typo
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP;

만약 실행중 다음과 같은 오류발생시 아래단계 실행

오류가 안난다면 하지 않아도 됩니다.

ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE KO16KSC5601
==> ORA-12714: invalid national character set specified

원인)

NATIONAL CHARACTER SET 은 Oracle9i 이후에는 UTF8과 AL16UTF16 만 제공
확인)

SELECT VALUE
FROM NLS_DATABASE_PARAMETERS
WHERE PARAMETER in ('NLS_NCHAR_CHARACTERSET','NLS_CHARACTERSET')
결과)

PARAMETER VALUE
---------------------------------- ---------------
NLS_CHARACTERSET KO16KSC5601

NLS_NCHAR_CHARACTERSET KO16KSC5601

조치)

update sys.props$ set value$='AL16UTF16' where name='NLS_NCHAR_CHARACTERSET';

이후 위의 조치2)를 다시실행하면 아래와 같은 결과를 얻을수 있다..

문제해결)

CHARACTERSET TYPES_USED_IN
------------------------------ -------------
US7ASCII CHAR
US7ASCII CLOB
AL16UTF16 NCHAR
AL16UTF16 NCLOB
AL16UTF16 NVARCHAR2
US7ASCII VARCHAR2

이후 SQLTools 나 토드접속시 에러가 나지 않고 객체리스트가 정상적으로 나오게 됩니다.

Posted by redkite
, |

리눅스에서 패스워드를 변경할 때 일반적으로 passwd 명령어를 입력한 후 새로운 패스워드를 두번 입력하는 방식을 사용하실 텐데요


자동화 스크립트 안에서는 이런 식의 대화형 쉘이 등장하면 골치 아프겠죠? 그래서 존재하는 옵션이 바로 Standard Input 입니다. 단 root 계정에서만 이 옵션을 사용할 수 있습니다.

passwd --stdin 계정

아래는 root 패스워드를 12345!@#$% 로 변경하는 모습입니다.


패스워드를 두번 입력 안해서 덜 귀찮고, 입력하는 패스워드가 눈에 보이기 때문에 실수 안해서 좋습니다. 뭐 보안상 취약하다고 할 수도 있겠지만요...

이제 한 걸음 더 나아가, 위 작업을 한줄로 처리하려면 어떻게 할까요? 바로 echo와 파이프 | 를 이용하는 것입니다.

echo '패스워드' | passwd --stdin 계정

아래는 한줄로 root 패스워드를 12345!@#$% 로 변경하는 모습입니다.


이처럼 echo와 passwd 명령어의 --stdin 옵션을 사용하면 패스워드 변경을 한줄로 처리할 수 있어, 자동화 스크립트에서 유용하게 활용할 수 있습니다. 이상입니다.

Posted by redkite
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함