Archive

Archive for January 9, 2012

Backup methodology

January 9, 2012 Leave a comment

1. Full backup

A whole backup

2.Differential backup

Backup different from the full backup

eg. 0=0, 1=0+1, 2=0+2, 3=0+3, 4=0+4, 5=0+5, 6=0+6

3. Incremental backup

Backup increment from previous day

eg. 0=0, 1=0+1, 2=1+2, 3=2+3, 4=3+4, 5=4+5, 6=5+6

PS:

0 — Sunday full

1 — Sunday

2 — Tuesday

3 — Wendesday

4 — Thursday

5 — Friday

6 — Saturday

 

Categories: Database

TCP-IP

January 9, 2012 Leave a comment

1. TCP/IP layers

TCP/IP

OSI

Application Application
presentation
Session
Transport Transport
Internet Network
Nwtwork access Data link
Physical

2. Subnet classes

Class A: 0.0.0.0 — 127.255.255.255

Class B: 128.0.0.0 — 191.255.255.255

Class C: 192.0.0.0 — 223.255.255.255

Class D: 224.0.0.0 — 239.255.255.255

Class E: 240.0.0.0 — 255.255.255.255

3. Private IP

Class A: 10.0.0.1 — 10.255.255.254

Class B: 172.16.0.1 — 172.31.255.254

Class C: 192.168.0.1 — 192.168.255.254

4. Auto Private IP

Class B: 169.254.0.0 — 169.254.255.255

 

 

 

Categories: TCP/IP

SQL join

January 9, 2012 Leave a comment

1. INNER JOIN

SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name

PS: INNER JOIN is the same as JOIN

The INNER JOIN keyword return rows when there is at least one match in both tables.

2. LEFT JOIN

SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name

PS: In some databases LEFT JOIN is called LEFT OUTER JOIN.

The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).

3. RIGHT JOIN

SELECT column_name(s)
FROM table_name1
RIGHT JOIN table_name2
ON table_name1.column_name=table_name2.column_name

PS: In some databases RIGHT JOIN is called RIGHT OUTER JOIN.

The RIGHT JOIN keyword returns all the rows from the right table (table_name2), even if there are no matches in the left table (table_name1).

4. FULL JOIN

SELECT column_name(s)
FROM table_name1
FULL JOIN table_name2
ON table_name1.column_name=table_name2.column_name

The FULL JOIN keyword return rows when there is a match in one of the tables.

Categories: SQL

Hard link and soft link

January 9, 2012 Leave a comment

1. Hard link

  • command

# ln sourceFile destinationFile

  • same inode number
  • delete original file not impact link file
  • only on same fs and machine

2. Soft link

  • command

# ln -s sourceFile destinationFile

  • different inode number
  • delete original file would lost the link file content
  • can link to different fs and machince
Categories: shell

Umask and sticky bit

January 9, 2012 Leave a comment

1. File and directory permission

rwxrwxrwx    — 777

r — 4

w — 2

x — 1

ugoa — user, group, other, all

2. Set umask

Preset the permission for files and directories to be created.

# umask    — show the umask value

777 – umask  —> for directories

777 – umask – 111 —> for files

3. Set sticky bit

  • SUID — 4, GUID –2, Sticky — 1
  • Sticky bit — a “t” at the end of others, for the directories, only the owner can delete files under that directories

— if “x” missing, “t” becomes “T”

# chmod 1777 dir1

# chmod +t dir2

# chmod o+t dir3

  • SUID — a “s” at the end of owner, for script, who run the script would act as the script owner

— if “x” missing, “s” becomes “S”

# chmod 4777 file1

# chmod u+s file1

  • SGID — a “s” a the end of group, for files. action as the group users

— if “x” missing, “s” becomes “S”

# chmod 2777 file1

# chmod g+s file2

Categories: Permission