常用数据库命令

来源:互联网 发布:大数据采集与预处理 编辑:程序博客网 时间:2024/05/23 10:37
db2 part command
db2 ?


db2 list applications
db2 force application all
db2stop force 
db2start
db2 backup db ksdbs
db2 backup db ksdbs online to “/backup/offline” with 4 buffers buffer 1024 parallelism 4 compress without prompting
db2 backup db ksdbs with 4 buffers buffer 1024 parallelism 4 compress without prompting 


groupadd test 
useradd -m -g test -d /home/test test
passwd test 
db2 connect to sample
db2 grant connect on database to user test 
db2 connect reset


db2 drop database ksdbs
db2 restore db ksdbs taken at 20130909163636
db2 restore db ksdbs from /db2home/db2inst1 taken at 20130909163636 
db2 rollforward db ksdbs to end of logs and stop;


alter table ac.his_cust_trader_accoun add primary key (pbuno);
alter table tablename drop primary key;
alter table ac.cust_info_change alter column operatesource set data type varchar(254);
alter table ac.cust_info_change alter column operatesource set default 'valuse';
alter table ac.cust_trader_account add column openstatus char(1) not null with default '';
comment on column ac.cust_trader_account.openstatus is 'this is a test';
db2 describe indexes for table ac.his_cust_trader_account show detail;
db2ilist -- this command is list all database instance;


set -o vi
grep -r ‘energywise’ *   --find from this catalogue
file crt_databse.sql /dev/filename --find the file type
dos2unix 123.sql  -- dos to unix text file format converter


cat /etc/passwd | grep db2
groupadd db2fgrp3
useradd -d /home/db2inst3 -g db2grp3 -m -s /bin/bash  db2inst3
cd /opt/IBM/db2/v10.1/instance/
./db2icrt -p 60000 -a SERVER -u db2fenc3 db2inst3
db2set db2comm=tcpip
db2set db2autostart=on
db2set db2codepage=1386
db2set db2country=86


vim /etc/services 
db2inst3   60000/tcp   #DB2 port
db2 update dbm cfg using SVCENAME 67901580
db2 list tablespaces show detail


db2 uncatalog db  ksdbs
db2 uncatalog node db2node 
db2 terminate
db2 catalog tcpip node test remote 10.10.12.187 server 60000
db2 catalog db ksdbs at node test
db2 terminate


db2set –all  --list all  have reseted  
db2 connect to ksdbs user user_name using password
db2 update dbm cfg SVCENAME db2inst3
db2 create db ksdbs using codeset gbk territory cn
db2 connect to ksdbs


db2  -tvf crt_db.sql
useradd -d /home/back3 -g db2grp3 -m -s /bin/bash  back3
passwd back3
source .bash_profile
unzip yuan_code.zip
ln  /usr/include/sys/timeb.h  /usr/include/timeb.h
vim /home/back3/bccbin/kssbmp/ksmbcc.ini
basefuncno=2222 
servercount=1
server1=10.10.10.34:20000:222
sbmpbu.ini
vim  /home/back3/bccbin/kssbmp/sbmpbu.ini
./decode –e db2inst3 
/home/back3/bccbin/kssbmp/sbmpbu.ini
password=088258a90f86e86f
vim  $home/make/environment.include
ifeq ($(user),)
db2conn := @db2 connect to ksdbs
else
db2conn := @db2 connect to ksdbs user $(user) using $(pwd)
endif


linux
shutdown -h now
shutdown -h 20:25
shutdown -r +30 'the system will reboot'
init 0
mkdir -p /yan/zheng/qing   --parents
mkdir -m 711 test2  --mode
tail -n 20 /etc/man.config
head -n 20 /etc/man.config
cat shell.sh | nl
tail yanzhengqing.info -n 30
head -n 20 /etc/man.config | tail -n 10


which whoami
updatedb   -- root environment
locate yan -n 10
find /home -user vbird
find / -name passwd
find /var -type s
find / -perm +7000 -exec ls -all {} \;
ifconfig eth0 192.168.0.20 netmask 255.255.255.0
route add default gw 192.168.0.254
/etc/init.d/networking restatr
service xinetd restart
/etc/xinetd.d/krb5-telnet


df -a  include dummy file systems
ln -s /bin  /root/bin
df -T print file system type
df -h  print sizes in human readable format
fdisk -l  List the partition tables for the  specified  devices  and  then exit.
partprobe 
mkfs -t ext3 /dev/hdc6
fsck -C -f -t ext3 /dev/hdc6   --check filesystem
badblocks -sv /dev/hdc6        --check badtrack
mount -a Mount all filesystems (of the given types) mentioned in fstab
mount -l Add  the  ext2,  ext3,  ext4 and XFS labels in the mount output
mount -t The  argument following the -t is used to indicate the file sys-temtype. 
mkdir /mnt/hdc6
mount /dev/hdc6 /mnt/hdc6
mount -t iso9660 /dev/cdrom /media/cdrom
mount -t vfat -o iocharset=cp950 /dev/sda1 /mnt/flash
mount --bind /home /mnt/home Remount a subtree somewhere  else  (so  that  its  contents  are available in both places). See above.
/etc/fstab
mount -o loop /root/centos5.2_x86_64.iso /mnt/centos_dvd
runlevel 
yum install ncompress


gzip -v man.config
bzip2 -z man.config
bzcat man.config.bz2
bzip2 -d man.config.bz2
tar -jcv -f /root/system.tar.bz2 --exclude=/root/etc* --exclude=/root/system.tar.bz2 /etc /root
df -h
dump -S /dev/sda8
dump -0u -f /root/sda8.dump /dev/sda8
dump -W
restore -i -f /root/etc.dump
mkisofs -r -v -o /tmp/system.img /root /home /etc
dump -0j -f /root/etc.dump.bz2 /etc
restore -t -f /root/boot.dump
restore -C -f /root/boot.dump
mount -o loop home.img /mnt
mkisofs -r -V 'linux_file' -o /tmp/system.img -m /home/lost+found -graft-point /root=/root /home=/home /etc=/etc
dd if=/etc/passwd of=/tmp/passwd.back 
dd if=/dev/hdc of=/tmp/mbr.back bs=512 count=1
dd if=/dev/hdc1 of=/tmp/boot.whole.disk
find /boot -print
cpio -ocvB > /dev/st0
cpio -idvc < /dev/st0


:set number
:set nonumber   :set nonu
:n1,n2 w [filename]
:! command   --goto shell desktop
:set nohlsearch
:set noautoindent   --stand in line
:set showmode
:syntax on   --show diffent clours




Visual Block  [Ctrl]+v
alias lm='ls -al'
echo $myname
unset name
source ~/.bashrc
ls -al /etc | less
find /home -name .bashrc > list_right 2> list_error
find /home -name .bashrc 2> /dev/null
find /home -name .bashrc &> list
find /home -name .bashrc > list 2>&1
cat > catfile
cat > catfile << "eof"   --input information  end of  eof
sync; sync; shutdown -h now  
ls /tmp/abc && touch /tmp/abc/hehe  -- one line excute two command
ls /tmp/abc || mkdir /tmp/abc
echo $PATH | cut -d ':' -f 3,5
cat /etc/passwd | sort -t ':' -k 3
last | cut -d ' ' -f1 | sort
last | cut -d ' ' -f1 | sort | uniq -c
cat /etc/man.config | wc
last | tee last.list | cut -d " " -f1
head -n 3 /etc/passwd /etc/shadow
join -t ':' /etc/passwd /etc/shadow
paste /etc/passwd /etc/shadow
grep '^MANPATH' /etc/man.config | head -n 3 | expand -t 6 - | cat -A    --^ is the string on the head line
split -b 300k /etc/termcap termcap
cat termcap* >> termcapback
tar -cvf - /home | tar -xvf -
dmesg | grep -n -A3 -B2 --color=auto 'eth'
grep -n 'the' regular_express.txt   --output line number
grep -vn 'the' regular_express.txt  --output out of the serch string
grep -in 'the' regular_express.txt  -ignore case 
grep -n 't[ae]st' regular_express.txt --only march one char
grep -n '[^g]oo' regular_express.txt
grep -n '[^a-z]oo' regular_express.txt
grep -n '^the' regular_express.txt
grep -n '^[a-z]' regular_express.txt
grep -n '^[^a-zA-Z]' regular_express.txt
grep -n '\.$' regular_express.txt    -- $ is mean end of line
grep -n '^$' regular_express.txt
grep -n 'g..d' regular_express.txt  -- .is mean anything of char but only one char
grep -n 'g.*g' regular_express.txt  --.*  is mean null  or  more same char
grep -n 'o\{2\}' regular_express.txt  -- \{  is mean {  and also  \} is } .  all of this is mean find include two o char in the string 
grep -n 'go\{2,5\}g' regular_express.txt  -- all os this is mean find distween two then five o char in the string
nl /etc/passwd | sed '2,5d'  --output line number and stand in line then delete 2-5line
nl /etc/passwd | sed '2a drink tea'  --add drink tea  after 2line
nl /etc/passwd | sed '2,5c No 2-5 number' --replace 2-5 for No 2-5 number
nl /etc/passwd | sed -n '5,7p' 
ifconfig eth0 | grep 'inet addr:'|sed 's/^.*addr://g'|sed 's/Bcast.*$/hello world ! /g'   --s mean replace   g is mean all line same strings  else  only the first one
sed -i '$a # This is a test' regular_express.txt   -- i is mean direct modify   $ is mean last line end  


grep -v '^$' regular_express.txt | grep -v '^#'    -- v mean opposite 
egrep -v '^$|^#' regular_express.txt 
egrep -n 'go+d' regular_express.txt   -- + mean  one or more before it char
egrep -n 'go?d' regular_express.txt   -- ? mean  zero or one before ith char
egrep -n 'gd|good|dog' regular_express.txt
egrep -n 'g(la|oo)d' regular_express.txt
grep -n '[!>]' regular_express.txt  -- [ ] all char only one march
last -n 5 | awk '{print $1 "\t" $3}'
cmp passwd.old passwd.new
netstat -tuln
newgrp users  --make users add into new group. this users is group name.
useradd -u 700 -g users vbird2
usermod -c "VBird's test" vbird2   -- c  means  notes
groupmod -g 201 -n mygroup group1


alias lm='ls -al'
0 0
原创粉丝点击