.

.

.


/: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

          (i.e., without -a or -p options)

                                                                             [FAILED]


*** An error occurred during the file system check.

*** Dropping you to a shell; the system will reboot

*** when you leave the shell.

Give root password for maintenance

(or type Control-D to continue): _


라는 에러가 나타났을경우...

해결방법은..



1. root 패스워드를 입력합니다.

   입력하면

  (Repair filesystem) 1 # _

   이 나옵니다.


2. fdisk -l  을 입력합니다.

     


파티션이 표시됩니다.


3. 파일시스템을 체크해야합니다. 

   모든파티션 각각을 아래 명령어로 입력합니다.

# e2fsck /dev/sda1

# e2fsck /dev/sda2

# e2fsck /dev/sda3

....




끝.






SELECT a.EMAIL

    FROM VM_OUT_SAWON a

    WHERE NOT EXISTS(SELECT email FROM VM_SAWON b WHERE a.email=b.email)


VM_OUT_SAWON테이블의 EMAIL값이  VM_SAWON테이블에 존재하지않을경우만 SELECT한다. (중복불허)


특정자리수로 특정값을 채우고싶을때 쓰는 함수



LPAD/RPAD(대상값 또는 컬럼, 대상값을 포함하여 채울크기, 채울값)


* 왼쪽에 채우기

예) SELECT LPAD('777',10,'0') as FIELD FROM 테이블명;

     결과값: 0000000777


* 오른쪽에 채우기

예) SELECT RPAD('777',10,'0') as FIELD FROM 테이블명;

     결과값: 7770000000

mysql -e 'SELECT * FROM 테이블명' -uDBID -pDBPASS DB_NAME > out.txt


굿

 

<HEAD>부분에 아래 자바스크립트를 삽입시킵니다.

<script language="javascript" type="text/JavaScript">
 function gogo_link() {
  if (window.opener && !window.opener.closed) {
   window.opener.location="주소를 입력합니다!";
   window.close();
  } else {
   alert("부모창이 닫혀있습니다");
  }
 }
</script>

 

링크를 겁니다

<a href="javascript:gogo_link();">GOGO</a>

 

 

끝납니다.

select seq_user,count(*) from tmem_addrbook group by seq_user having count(*) > 2;

 

 

while true ; do command ; sleep 1; done

 

굿.

테이블이 많을때 비정상적으로 출력이 되어


mysql 오류를 보면...;

Can't find file: './CrediMail/tb_webhard554_hits.frm' (errno: 24)

.....

라고 출력되고, 에러를 토함.


해결방법

my.cnf 파일에

open_files_limit = 4096


추가후

mysql을 재기동하여 확인한다.

mysql> show variables like 'open_files%';

+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| open_files_limit | 4096  |
+------------------+-------+


끝.

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

근데 이렇게 쉽게 변경되어있지 않고 1024로 박혀있는 경우가있다.

그럴경우 다시 mysql 에러로그를 보면

[Warning] Could not increase number of max_open_files to more than 1024 (request: 4096)

라는 에러가 나온다.


이러면 시스템상에서 제한을 풀어주어야 한다.

# ulimit -a |grep open  을 해보면

open files                      (-n) 1024  로 되어있음.


root계정으로 들어간후

# vi /etc/security/limits.conf

을 열어서


....

web(계정명)        soft    nofile           4096

web(계정명)        hard    nofile           4096

....


추가하고 리눅스 재기동!


mysql 에 접속하여 다시 확인해보면 제대로 되어있음.

그래도 에러가난다면 리밋을 더 올림.


끝.







'업무 > DB' 카테고리의 다른 글

[mysql] 커맨드에서 쿼리날리기  (0) 2012.11.19
[db] 중복된 값 찾기  (0) 2012.09.21
[mysql] 개발DB만들기  (0) 2012.08.21
[mysql] sql덤프받기(특정조건, 문자셋지정해서)  (0) 2012.08.20
[oracle] 테이블 복사하기  (0) 2012.05.31



개발디비 만들기


1. 권한주기

insert into db values('localhost','CrediMail_dev','mobigen','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y','y');


2. 권한 flush 

flush privileges;


3. DB복사

cp -a mail mail_dev


끝.




mysqldump -tn --skip-opt --default-character-set=euckr -uuserid -puserpass DBNAME userfile --where="email='condtion_value'"


'업무 > DB' 카테고리의 다른 글

[mysql] open_files_limit늘리기(Cant' open file "errno: 24")  (0) 2012.09.05
[mysql] 개발DB만들기  (0) 2012.08.21
[oracle] 테이블 복사하기  (0) 2012.05.31
[oracle] DB 테이블 이름 변경  (0) 2012.05.31
[oracle] 시퀀스 조작하기.  (0) 2012.05.09


자바로 OS나 버전, 경로등 시스템정보를 알아내기



    System.out.println("OS["+ System.getProperty("os.name")+"]" );

    System.out.println("OS_VER["+ System.getProperty("os.version")+"]" );

    System.out.println("USER["+ System.getProperty("user.name")+"]" );

    System.out.println("File_Separator["+ System.getProperty("file.separator")+"]" );

    System.out.println("Path_Separator["+ System.getProperty("path.separator")+"]" );

    System.out.println("Current_working_dir["+ System.getProperty("user.dir")+"]" );




[결과값]

OS[AIX]

OS_VER[5.3]

USER[webmail]

File_Separator[/]

Path_Separator[:]

Current_working_dir[/was/webmail/myst/java_test]


파일내용은 (탭구분자, ANSI)

apple 사과

banana 바나나

kiwi 키위

subak 수박

melon 멜론

orange 오렌지




이것을 해시맵으로 읽어들여 키와 밸류를 출력시킨다.

static void jwtest() {

try {

BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("jwtest.txt"), "MS949"));

//BufferedReader br = new BufferedReader(new FileReader("jwtest.txt"));

String str ="";

Map<String, String> fruit = new HashMap<String, String>();

while ( (str = br.readLine()) != null ) {

String[] arr = str.split("\t");

fruit.put(arr[0], arr[1]);

}

Iterator kv = fruit.entrySet().iterator();

while(kv.hasNext()) {

Map.Entry entry = (Map.Entry) kv.next();

System.out.println(entry.getKey()+"__"+entry.getValue());

}

br.close();

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {

e.printStackTrace();

}

}





테이블을 복사하는 방법.

아래예는 JWUSER 테이블에서 JWUSER_NEW로 복사한후

기존JWUSER는 JWUSER_OLD,  카피한 테이블 JWUSER_NEW는 다시 JWUSER로 바까치기하는 예임.

제품의 버전업시 테이블 데이터타입이 변경되었을시 깔끔하게 바꿔치기하는데 쓰임. 


1. 테이블을 만듬

CREATE TABLE JWUSER_NEW

(

  SEQ_USER         NUMBER(19),

  USERID           VARCHAR2(60 BYTE),

  USERDOMAIN       VARCHAR2(100 BYTE),

  ....

  ....

  ....

  CONSTRAINT JWUSER_NEW_PK PRIMARY KEY (seq_user)

);


2. 복사함. ( jwuser-> jwuser_new로 복사)

INSERT INTO jwuser_new(SEQ_USER, USERID, USERDOMAIN, ....) SELECT * FROM jwuser;


3. 기타부가적으로 변경 (테이블변경)

-- 기존JWUSER -> JWUSER_OLD 로 변경

ALTER TABLE JWUSER RENAME CONSTRAINT JWUSER_PK to JWUSER_OLD_PK;

ALTER TABLE JWUSER RENAME TO JWUSER_OLD;


-- 신규테이블 JWUSER_NEW -> JWUSER 로 변경

ALTER TABLE JWUSER_NEW RENAME CONSTRAINT JWUSER_NEW_PK to JWUSER_PK;

ALTER TABLE JWUSER_NEW RENAME TO JWUSER;



4. 부가잡다구리정보 : CONSTRAINT NAME 조회

SQL> SELECT TABLE_NAME, CONSTRAINT_NAME FROM USER_CONSTRAINTS WHERE TABLE_NAME IN('JWUSER');


TABLE_NAME                            CONSTRAINT_NAME

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

JWUSER                                    JWUSER_PK



'업무 > DB' 카테고리의 다른 글

[mysql] 개발DB만들기  (0) 2012.08.21
[mysql] sql덤프받기(특정조건, 문자셋지정해서)  (0) 2012.08.20
[oracle] DB 테이블 이름 변경  (0) 2012.05.31
[oracle] 시퀀스 조작하기.  (0) 2012.05.09
[oracle] 날짜 집어넣기  (0) 2012.04.10

초간단


ALTER TABLE tuser_temp RENAME TO tuser;



EUC-KR을 UTF-8로 바꿀때 보통

my $euckr_to_utf8 = Text::Iconv->new("EUC-KR","UTF-8");

$ibuf = $euckr_to_utf8->convert($ibuf);

이런식으로 변환을 하게됩니다.


하지만 HP-UX에서는

Unsupported conversion from EUC-KR to UTF-8: 잘못된 인수입니다. at ./test_encoding.pl line 12.

라면서 오류를 뿜습니다.



HP에서는 

    my $euckr_to_utf8 = Text::Iconv->new("eucKR","utf8");

    $ibuf = $euckr_to_utf8->convert($ibuf);

이렇게 eucKR, utf8 이라고 써야 오류없이 변환됩니다.


참고로 gnu iconv 는 euckr, utf-8입니다.



이 정보는 HP홈페이지 기술지원에서 참고하였습니다.


1. 클래스 작성

package com.jw.customized.sync;


import org.apache.commons.logging.Log;

import org.apache.commons.logging.LogFactory;

import org.quartz.JobExecutionContext;

import org.quartz.JobExecutionException;

import org.quartz.StatefulJob;

import org.springframework.scheduling.quartz.QuartzJobBean;


import com.jw.customized.migration.DeptMigration;


public class SyncJob extends QuartzJobBean implements StatefulJob {

private static final Log logger = LogFactory.getLog(SyncJob.class);

private DeptMigration deptMigration = null;

public DeptMigration getDeptMigration() {

return deptMigration;

}


public void setDeptMigration(DeptMigration deptMigration) {

this.deptMigration = deptMigration;

}


@Override

protected void executeInternal(JobExecutionContext jobexecutioncontext)

       throws JobExecutionException {

if (this.deptMigration != null) {

if (this.deptMigration.isDoingExecute()) {

logger.warn("실행중입니다.");

} else {

this.deptMigration.execute();

}

}

}

}



2. xml에 설정하고 Quartz 설정

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">

<beans default-init-method="initialize">


.....

.....


        <bean id="migration.DeptMigration" class="com.jw.customized.migration.DeptMigration">

                <property name="dbConnectionManager"><ref bean="datasource.DBConnectionManager" /></property>

        </bean>

    <!-- scheduler -->
        <bean name="SchedulerFactoryBean" class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
                <property name="triggers">
                        <list>
                                <ref bean="sync.DeptMigrationJob.trigger" />
                        </list>
                </property>
                <property name="configLocation"><value>classpath:quartz.properties</value></property>
        </bean>
        <bean name="sync.DeptMigrationJob" class="org.springframework.scheduling.quartz.JobDetailBean">
                <property name="jobClass" value="com.jw.customized.sync.SyncJob" />
                <property name="jobDataAsMap">
                        <map>
                                <entry key="deptMigration"><ref bean="migration.DeptMigration" /></entry>
                        </map>
                </property>
        </bean>
        <bean id="sync.DeptMigrationJob.trigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
<!--
  SimpleTriggerBean : 몇분마다 실행....
      __ property로 repeatInterval 을 갖음
  CronTriggerBean : 정기적 실행( 매시 언제..이런식)
      __ property로 cronExpression을 갖음
-->
                <!-- see the example of method invoking job above -->
                <property name="jobDetail" ref="sync.DeptMigrationJob" />
                <!-- 매일 02:20, 12/20 분에 수행  -->
                <property name="cronExpression" value="0 20 2,12 * * ?" />
        </bean>
</beans>


'업무 > Java' 카테고리의 다른 글

[java] 시스템정보 알아내기  (0) 2012.06.22
[java] 파일에서 읽어 맵에저장  (0) 2012.06.11
[java] euc-kr , utf-8 인코딩 변환  (0) 2012.04.30
[java] hashtable 사용  (0) 2012.02.08
[java] 파일 읽기  (0) 2012.02.08


기존 시퀀스를 초기화하고 새로 등록할때 쓰는 것임.


* 시퀀스 조회하기

select * from user_sequences;


* 시퀀스 지우기

drop sequence SEQ_이름;


* 새로운 시퀀스로 초기화

CREATE SEQUENCE SEQ_이름 START WITH 새로운값;



수고하세요~

'업무 > DB' 카테고리의 다른 글

[oracle] 테이블 복사하기  (0) 2012.05.31
[oracle] DB 테이블 이름 변경  (0) 2012.05.31
[oracle] 날짜 집어넣기  (0) 2012.04.10
[mysql] auto_increment 자동증가값 초기화  (0) 2012.04.04
[mysql] 파일에있는 SQL문 실행  (0) 2012.01.31

간단히



String euckr = “가나다”;  // EUC-KR

String utf8 = new String(eucStr.getBytes(“euc-kr”), “utf-8″);


'업무 > Java' 카테고리의 다른 글

[java] 파일에서 읽어 맵에저장  (0) 2012.06.11
[java] Spring 스케줄러, QuartzJobBean  (0) 2012.05.21
[java] hashtable 사용  (0) 2012.02.08
[java] 파일 읽기  (0) 2012.02.08
[java] 파일 실행해서 출력시키기  (0) 2012.02.07


INSERT INTO userfile(file_seq, fdate, filehosts)  VALUES('46', to_date('2011-07-15 08:26:54','YYYY-MM-DD HH24:MI:SS'), 'localhost');


 to_date('15/07/05 12','DD/MM/RR HH')





히히히히ㅣㅎ

alter table 테이블명 auto_increment=1;



        if ($full_path =~ /.*\/\d\/([\w\-.]\/[\w\-.]\/[\w\-.]\/[\w\-.]+)/ ) {
            print $1."\n";
        } 


** init process 실행 레벨



0 : init 프로세스에게 모든 프로세스를 종료하고 시스템을 정지 시키도록 한다. 이 레벨을 initdefault로 설정하면 안된다.

1 : 리눅스 시스템을 단일 사용자 모드로 실행한다. (싱글모드 부팅)

2 : 네트워크에 연결하지 않은 채 다중 사용자 모드로 실행한다. 네트워크 파일시스템(NFS)을 사용하지 않는다.

3 : 네트워크에 연결하여 다중 사용자 모드로 실행한다. (콘솔모드 부팅) 리눅스의 모든 기능을 정상적으로 사용할 수 있는 실행 레벨이며, X 윈도우를 사용하지 않을 때는 이 레벨을 initdefault로 실행한다.

4 : 사용하지 않는다.

5 : X11 즉, X 윈도우로 부팅한다. (GUI모드 부팅)

6 : 실행 중인 모든 프로세스를 종료하고 시스템을 재실행한다. 이 레벨을 initdefault로 설정하면 안된다.




* 증상

[root@localhost ~]# yum install vim

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: centos.tt.co.kr

 * extras: centos.tt.co.kr

 * updates: centos.tt.co.kr

Setting up Install Process

No package vim available.

Nothing to do


이렇게 나오고 vim이 안될경우는..

[root@localhost ~]# yum list |grep vim

vim-common.i386                          2:7.0.109-7.el5               installed

vim-minimal.i386                         2:7.0.109-7.el5               installed

vim-X11.i386                             2:7.0.109-7.el5               base

vim-enhanced.i386                        2:7.0.109-7.el5               base


에서 vim-enhanced를 설치하면 됩니다.
 
# yum install vim-enhanced.i386 





파일이 무진장 많을경우
원하는 날짜의 파일만 출력하고 싶을때..

* 하루범위의 파일 출력

$ find . -type f -mtime -1



* 2시간 범위의 파일 출력

$ find . -type f -mmin -120



해쉬의 사이즈를 구합니다.

#!/usr/bin/perl


MAIN:

{

    my $test  = {};


    $test->{0}=0;

    $test->{1}=0;

    $test->{2}=0;

    $test->{3}=0;

    $test->{5}=0;


    my $len = scalar(keys %{$test});


    print "$len\n";

}


결과값

5




Perl 에서 DBD-mysql 모듈을 설치했을때 
Mysql기본경로가 다를경우 에러가 발생합니다.



perl Makefile.PL 

을 실행했을시에...

Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 83.


Cannot find the file 'mysql_config'! Your execution PATH doesn't seem

not contain the path to mysql_config. Resorting to guessed values!

Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 478.

Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located

Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 478.

Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located

Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 478.

Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located



PLEASE NOTE:


For 'make test' to run properly, you must ensure that the

database user 'root' can connect to your MySQL server

and has the proper privileges that these tests require such

as 'drop table', 'create table', 'drop procedure', 'create procedure'

as well as others.


mysql> grant all privileges on test.* to 'root'@'localhost' identified by 's3kr1t';


You can also optionally set the user to run 'make test' with:


perl Makefile.PL --testuser=username


Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 478.

Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located

Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 478.

Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located

Can't exec "mysql_config": 그런 파일이나 디렉토리가 없음 at Makefile.PL line 478.

Can't find mysql_config. Use --mysql_config option to specify where mysql_config is located

Failed to determine directory of mysql.h. Use


  perl Makefile.PL --cflags=-I<dir>


to set this directory. For details see the INSTALL.html file,

section "C Compiler flags" or type


  perl Makefile.PL --help


라는 에러가 발생하네요.


해결방법으로는..

perl Makefile.PL --mysql_config=/usr/local/mysql/bin/mysql_config

라고 --mysql_config에 mysql경로를 미리 알려주면 간단히 해결됩니다~




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

/usr/bin/ld: cannot find -lz

collect2: ld returned 1 exit status

요런 에러가 나타났을땐 zlib 을 설치해야한다.

http://www.zlib.net/  에가서 tar버전을 다운받은후

아래와같은 과정을 거친다.

tar xvfzp zlib-1.2.6.tar.gz
mv zlib-1.2.6 /usr/local/zlib
cd /usr/local/zlib/
./configure -s
make
./configure
make install
ls -alF libz.so* 치면
    lrwxrwxrwx 1 root root    13  2월 20 13:18 libz.so -> libz.so.1.2.6*

    lrwxrwxrwx 1 root root    13  2월 20 13:18 libz.so.1 -> libz.so.1.2.6*

    -rwxr-xr-x 1 root root 92821  2월 20 13:18 libz.so.1.2.6*
cp libz.so* /usr/local/lib
cd /usr/local/lib
rm -rf libz.so libz.so.1
ln -s libz.so.1.2.6 libz.so
ln -s libz.so.1.2.6 libz.so.1
vi /etc/ld.so.conf  ==> /usr/local/lib 추가하고
ldconfig 


이후 make install시 에러가 나지 않고 설치완료된다!



* 파일 존재여부

if [ -f ./test.txt ]
then
    echo "존재합니다"
else
    echo "존재하지 않습니다"
fi 


* 경로 존재여부

if [ -d /home/webmail/test ]
then
    echo "존재합니다"
else
    echo "존재하지 않습니다"
fi 



쉘스크립트에서 함수를 사용하는 방법.

* 함수정의

necho()
{
    echo "ha    * $1"


* 사용

necho "hello"


* 출력

ha    * hello



하드디스크 D:\virtualbox_vm\xp.vdi을(를) 여는 데 실패했습니다.


Cannot register the hard disk 'D:\virtualbox_vm\xp.vdi' {ee3caf1e-fb7e-4189-bf40-600d0609f46d} because a hard disk 'D:\v_xp\xp.vdi' with UUID {ee3caf1e-fb7e-4189-bf40-600d0609f46d} already exists.


결과 코드: E_INVALIDARG (0x80070057)

구성 요소: VirtualBox

인터페이스: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}



이런 메세지가 나오면서 추가가 안될때는..

cmd를 실행시키셔서

>cd "C:\Program Files\Oracle\VirtualBox"

>VBoxManage.exe internalcommands sethduuid "D:\virtualbox_vm\xp.vdi"


하고 추가하면 추가잘됨.

lc_str=`echo $THIS_OS | tr A-Z a-z`
echo $lc_str 


+ Recent posts