随笔-4  评论-0  文章-0  trackbacks-0
  2013年8月22日
今天搭建linux的DNS主从服务器时遇到修改了/etc/resolv.conf之后,重启系统或network后发现又恢复到以前的状态。网上查了一下说是修改
 /etc/sysconfig/network-scripts/ifcfg-eth0 。添加或修改PEERDNS=no。
但是service network restart发现还是自动恢复了,后来发现直接把dns服务器ip添加到
 /etc/sysconfig/network-scripts/ifcfg-eth0 就没问题了,如下:

DEVICE="eth0"
BOOTPROTO=none
IPV6INIT="yes"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE=Ethernet
IPADDR=192.168.1.12
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
GATEWAY=192.168.1.1
DNS1=192.168.1.12
DNS2=202.106.46.151
HWADDR=00:0c:29:da:0c:7d
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
PEERDNS=no


注:DNS1和DNS2就是要在/etc/resolv.conf配置的dns服务器ip。
posted @ 2013-08-22 22:27 cuilihui 阅读(3099) | 评论 (0)编辑 收藏
  2012年4月24日
从数据库中把所有表数据导出: 
1.编辑一个文件selectout.sql: 
set nocount on
use databasename
go
select 'bcp databasename..' + name + ' out d:\temp\' + name + '.txt -Uusername -Ppassword -Sservername -c ' from sysobjects where type='U'
go
2.在cmd中执行: 
isql -Uusername -Ppassword -Sservername -i d:\selectout.sql -o d:\bcpout.bat
3.执行d:\bcpout.bat文件, 可以把数据导出到d:\temp\目录。 
把所有表数据导入到数据库时,将上面的out改为in 

4.bcp导入导出: 
导出数据:
bcp DatabaseName.dbo.tableName out D:\tableName.txt -SServerName -Usa -P -c -b 10000
导入数据:
bcp DatabaseName.dbo.tableName in D:\tableName.txt -SServerName -Usa -P -c -b 10000
在导入大量数据时加上-b参数,分批提交不以致于数据库日志被塞满。 
posted @ 2012-04-24 14:16 cuilihui 阅读(2514) | 评论 (0)编辑 收藏
  2012年4月20日
     摘要: 长度和语法分析 datalength(char_expr)    在char_expr中返回字符的长度值,忽略尾空 substring(expression,start,length)    返回部分字符串 right(char_expr,int_expr)    返回char_...  阅读全文
posted @ 2012-04-20 11:13 cuilihui 阅读(212) | 评论 (0)编辑 收藏
  2012年4月19日
select  isnull(convert(numeric(10,2), round(convert(numeric(10,0),x.ocr_file_num)/x.file_num * 100,2)),0) 
from (select sum(total_file_num) as file_num,sum(auto_file_num) as ocr_file_num 
from ws_ocr_report noholdlock 
where tr_date>= '2012-03-31' and tr_date <='2012-03-31')x

numeric(10,0) 10位数字 小数点后0位 ;
convert(numeric(10,0),x.ocr_file_num) 把x.ocr_file_num 转为小数点后0位的10位数字;
round(a,b) 保留数字a小数点后b位小数;


select x.imp_type imp_type,isnull(y.un_auidted_num,0) un_auidted_num from 
(select imp_type from imp_audit_type noholdlock where disp_sign=0 and tree_type=0 )x,(select imp_type,count(1) as un_auidted_num from imp_result noholdlock  where 1=1 
 group by imp_type)y
  noholdlock  where x.imp_type *= y.imp_type order by x.imp_type
等价于
select x.imp_type imp_type,isnull(y.un_auidted_num,0) un_auidted_num from 
(select imp_type from imp_audit_type noholdlock where disp_sign=0 and tree_type=0 )x left join (select imp_type,count(1) as un_auidted_num from imp_result noholdlock  where 1=1 
 group by imp_type)y
  noholdlock  on x.imp_type = y.imp_type order by x.imp_type
where x.imp_type *= y.imp_type order by x.imp_type 相当于使用join的on条件;

通过在 select 或 readtext 命令中将 holdlock、noholdlock 和 shared 选项应用到单个表来替换某个会话的锁定级别:
使用级别    关键字        作用
1             noholdlock  直到事务结束再持有锁;在级别 3 使用以强制执行级别 1
2, 3         holdlock      持有共享锁直到事务完成;在级别 1使用以强制执行级别 3
无            shared        在为更新操作打开游标时,对 select语句应用共享锁而非更新锁

批处理:
  bcp db..ds_aptr in f:/ftproot/dataSource/20120418\ABIS-APTR-1G-20120418 -e E:\DataManager\error\ds_aptr20120418.txt -c -t"|!" -r"\n" -Uad -Shn -Pbj -Jcp936 -b10000
ds_aptr数据表  in导入 f:/ftproot/dataSource/20120418\ABIS-APTR-1G-20120418
-e E:\DataManager\error\ds_aptr20120418.txt 错误日志
-t"|!" 以|!为列的分隔符
-r"\n" 以\n为一条数据的分隔符
-Uad 用户名ad
-Shn 服务器hn
-Pbj 密码bj
-Jcp936 编码cp936
-b10000 分批10000条提交

 
posted @ 2012-04-19 17:33 cuilihui 阅读(476) | 评论 (0)编辑 收藏
仅列出标题