Linux - Ubuntu

System 2012.09.25 11:29 Posted by Jay Choi

Ubuntu Basic Command

  1. Install package

    apt-get install {Package Name}

     

  2. Check installed package

    dpkg --list

    dpkg --list | less

    dpkg --list | grep -i 'http'

     

     

  3. Uninstall package

    apt-get remove mplayer : For example remove package called mplayer, enter:

    apt-get --purge remove lighttpd : Remove package called lighttpd along with all configuration files, enter:

     

  4. Update and Upgrade

    apt-get update

    apt-get upgrade

     

  5. Search package

    apt-cache search {package-name}

    aptitude search {package-name}


DBMS : MySql

Database 2012.09.25 11:27 Posted by Jay Choi

mysql 결과로 csv파일 생성

 

SELECT *

INTO OUTFILE "/tmp/result.csv"

FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'

LINES TERMINATED BY "\n"

FROM table;

 

txt 파일을 mysql에 로드

 

LOAD DATA INFILE '[filename]'

INTO TABLE [tablename]

FIELDS TERMINATED BY '\r' ENCLOSED BY '\r\n' ESCAPED BY '\\' LINES TERMINATED BY '\r\n' ([columnname], ...);

Check procedure

Database 2012.04.05 16:34 Posted by Jay Choi


1. 사용중인 테이블 조회

WITH sp_list AS (
    SELECT o.name AS proc_name
           , oo.name AS table_name
           , Row_number() OVER(partition by o.name, oo.name ORDER BY o.name, oo.name) AS row
      FROM sysdepends d
           INNER JOIN sysobjects o ON o.id = d.id
           INNER JOIN sysobjects oo ON oo.id = d.depid
     WHERE o.xtype = 'P'
)
SELECT proc_name, table_name
  FROM sp_list
 WHERE row = 1
 ORDER BY proc_name, table_name


2. 인덱스 조각화율 체크

SELECT a.index_id, name, avg_fragmentation_in_percent
FROM sys.dm_db_index_physical_stats (DB_ID(), OBJECT_ID(N'Production.Product'), NULL, NULL, NULL) AS a
    JOIN sys.indexes AS b ON a.object_id = b.object_id AND a.index_id = b.index_id;
GO


퍼왔음...