linux服务器配置笔记 http://blog.donews.com/leiyan Wed, 06 Aug 2008 01:30:00 +0000 http://wordpress.org/?v=2.9.2 en hourly 1 mysql错误解决手记 http://blog.donews.com/leiyan/archive/2008/08/06/1332940.aspx http://blog.donews.com/leiyan/archive/2008/08/06/1332940.aspx#comments Wed, 06 Aug 2008 01:30:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2008/08/06/1332940.aspx 今日服务器重启后导致mysql无法启动查看/usr/local/mysql/data/中的err后发现报 Failed to open log (file './mysql-bin.000055', errno 13),估计是日志文件丢失了,解决方法:修改/etc/my.cnf 注释掉log-bin=mysql-bin问题解决

]]>
今日服务器重启后导致mysql无法启动查看/usr/local/mysql/data/中的err后发现报 Failed to open log (file ‘./mysql-bin.000055′, errno 13),估计是日志文件丢失了,解决方法:修改/etc/my.cnf 注释掉log-bin=mysql-bin问题解决

]]>
http://blog.donews.com/leiyan/archive/2008/08/06/1332940.aspx/feed 0
mysql+bind配置步骤 http://blog.donews.com/leiyan/archive/2007/01/18/1115837.aspx http://blog.donews.com/leiyan/archive/2007/01/18/1115837.aspx#comments Thu, 18 Jan 2007 06:49:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2007/01/18/1115837.aspx [root@fjdc bind]# tar -zxvf bind-9.3.3.tar.gz
[root@fjdc bind]# tar -zxvf mysql-bind-0-1.gz
[root@fjdc bind]# cp mysql-bind-0.1/mysqldb.c bind-9.3.3/bin/named/
[root@fjdc bind]# cp mysql-bind-0.1/mysqldb.h bind-9.3.3/bin/named/include/
[root@fjdc bind]# cd bind-9.3.3
[root@fjdc bind-9.3.3]# vi bin/named/Makefile.in
找到:
# Add database drivers here.
#
DBDRIVER_OBJS =
DBDRIVER_SRCS =
DBDRIVER_INCLUDES =
DBDRIVER_LIBS =
改成
DB]]>
[root@fjdc bind]# tar -zxvf bind-9.3.3.tar.gz
[root@fjdc bind]# tar -zxvf mysql-bind-0-1.gz
[root@fjdc bind]# cp mysql-bind-0.1/mysqldb.c bind-9.3.3/bin/named/
[root@fjdc bind]# cp mysql-bind-0.1/mysqldb.h bind-9.3.3/bin/named/include/
[root@fjdc bind]# cd bind-9.3.3
[root@fjdc bind-9.3.3]# vi bin/named/Makefile.in
找到:
# Add database drivers here.
#
DBDRIVER_OBJS =
DBDRIVER_SRCS =
DBDRIVER_INCLUDES =
DBDRIVER_LIBS =
改成
DBDRIVER_OBJS = mysqldb.@O@
DBDRIVER_SRCS = mysqldb.c
DBDRIVER_INCLUDES = -I’/usr/local/mysql/include’
DBDRIVER_LIBS = -L’/usr/local/mysql/lib’ -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv

[root@fjdc bind-9.3.3]# vi bin/named/main.c
找到/*
* Add calls to register sdb drivers here.
*/
/* xxdb_init(); */
添加 mysqldb_init();
找到
/*
* Add calls to unregister sdb drivers here.
*/
/* xxdb_clear(); */
添加 mysqldb_clear();

./configure –prefix=/usr/local/named –enable-threads
make
make install
[root@fjdc named]#cd /usr/local/named/etc
[root@fjdc etc]# ../sbin/rndc-confgen >rndc.conf
[root@fjdc etc]# tail -10 rndc.conf | head -9 | sed s/#\//g >named.conf
[root@fjdc etc]# vi localhost.zone
$TTL 86400
$ORIGIN localhost.
        @ 1D IN SOA @ root (
                                42 ; serial (d. adams)
                                3H ; refresh
                                15M ; retry
                                1W ; expiry
                                1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1

[root@fjdc etc]# vi named.local
$TTL 600
@ IN SOA localhost. root.localhost. (
                                1997022700 ; Serial
                                28800 ; Refresh
                                14400 ; Retry
                                3600000 ; Expire
                                86400 ) ; Minimum
@       IN      NS      localhost.
1       IN      A       127.0.0.1

[root@fjdc etc]# dig > named.root
[root@fjdc etc]# vi named.conf
添加
 zone "." {
        type hint;
        file "named.root";
 };

 zone "localhost" {
        type master;
        file "named.local";
 };

 zone "0.0.127.in-addr.arpa" {
        type master;
        file "named.127.0.0.1";
 };

 zone "mydomain.com" {
        type master;
        database "mysqldb ddns mydomain 127.0.0.1 ddns ddns";
 };

 zone "1.16.172.in-addr.arpa" {
        type master;
        database "mysqldb ddns ptr localhost ddns ddns";
 };

mysql>
建立ddns数据库
建立ddns用户,密码也为ddns;
导入sql到ddns
CREATE TABLE mydomain (
name varchar(255) default NULL,
ttl int(11) default NULL,
rdtype varchar(255) default NULL,
rdata varchar(255) default NULL
) TYPE=MyISAM;

INSERT INTO mydomain VALUES (‘mydomain.com’, 259200, ‘SOA’, ‘mydomain.com. www.mydomain.com. 200309181 28800 7200 86400 28800′);
INSERT INTO mydomain VALUES (‘mydomain.com’, 259200, ‘NS’, ‘ns0.mydomain.com.’);
INSERT INTO mydomain VALUES (‘mydomain.com’, 259200, ‘NS’, ‘ns1.mydomain.com.’);
INSERT INTO mydomain VALUES (‘mydomain.com’, 259200, ‘MX’, ‘10 mail.mydomain.com.’);
INSERT INTO mydomain VALUES (‘w0.mydomain.com’, 259200, ‘A’, ‘172.16.1.235′);
INSERT INTO mydomain VALUES (‘w1.mydomain.com’, 259200, ‘A’, ‘172.16.1.100′);
INSERT INTO mydomain VALUES (‘mydomain.com’, 259200, ‘Cname’, ‘w0.mydomain.com.’);
INSERT INTO mydomain VALUES (‘mail.mydomain.com’, 259200, ‘Cname’, ‘w0.mydomain.com.’);
INSERT INTO mydomain VALUES (‘ns0.mydomain.com’, 259200, ‘Cname’, ‘w0.mydomain.com.’);
INSERT INTO mydomain VALUES (‘ns1.mydomain.com’, 259200, ‘Cname’, ‘w1.mydomain.com.’);
INSERT INTO mydomain VALUES (‘www.mydomain.com’, 259200, ‘Cname’, ‘w0.mydomain.com.’);
INSERT INTO mydomain VALUES (‘ftp.mydomain.com’, 259200, ‘Cname’, ‘w0.mydomain.com.’);

CREATE TABLE ptr (
name varchar(255) default NULL,
ttl int(11) default NULL,
rdtype varchar(255) default NULL,
rdata varchar(255) default NULL
) TYPE=MyISAM;

INSERT INTO `ptr` VALUES (‘1.16.172.in-addr.arpa’, 17600, ‘SOA’, ‘mydomain.com. www.mydomain.com. 200309181 28800 7200 86400 28800′);
INSERT INTO `ptr` VALUES (‘1.16.172.in-addr.arpa’, 17600, ‘NS’, ‘ns0.mydomain.com.’);
INSERT INTO `ptr` VALUES (‘1.16.172.in-addr.arpa’, 17600, ‘NS’, ‘ns1.mydomain.com.’);
INSERT INTO `ptr` VALUES (‘235.1.16.172.in-addr.arpa’, 17600, ‘PTR’, ‘ddns.mydomain.’);

/usr/local/named/sbin/named -c /usr/local/named/etc/named.conf //启动bind
tail -f /var/log/messages | grep named //查看bind日志

]]>
http://blog.donews.com/leiyan/archive/2007/01/18/1115837.aspx/feed 0
Oracle穿越防火墙设置 http://blog.donews.com/leiyan/archive/2007/01/09/1111174.aspx http://blog.donews.com/leiyan/archive/2007/01/09/1111174.aspx#comments Tue, 09 Jan 2007 05:00:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2007/01/09/1111174.aspx 没想到一个困扰我3年的问题,竟然在无意中给我找到了答案,看来今年运气很好,要好好把握了

方法一:在windows2000的注册表中,hkey_local_machinesoftwareoraclehome0下加入字符串值:
USE_SHARED_SOCKET=TRUE,即可
方法二:1、首先将数据库实例改为SHARED SERVER模式
2、以SYSDBA登录SQLPLUS,通过SQLPLUS生成系统当前的参数设置文件pfile:create pfile='d:init.ora' from spfile;
3、修改d:init.ora文件,在其中增加(用editplus编辑):*.service_names='your service name'和*.dispatchers='(address=(protocol=tcp)]]> 没想到一个困扰我3年的问题,竟然在无意中给我找到了答案,看来今年运气很好,要好好把握了

方法一:在windows2000的注册表中,hkey_local_machinesoftwareoraclehome0下加入字符串值:
USE_SHARED_SOCKET=TRUE,即可
方法二:1、首先将数据库实例改为SHARED SERVER模式
2、以SYSDBA登录SQLPLUS,通过SQLPLUS生成系统当前的参数设置文件pfile:create pfile=’d:init.ora’ from spfile;
3、修改d:init.ora文件,在其中增加(用editplus编辑):*.service_names=’your service name’和*.dispatchers=’(address=(protocol=tcp)(host=localhost)(port=1521) (dispatchers=1)’
4、生成新的SPFILE:create spfile from pfile=’d:init.ora’;
5、重启动数据库。
6、在防火墙中开放1521端口。
方法三:在数据库端(也可以是另外的机器,但是cman的机器必须和数据库都在防火墙的后面)安装了cman的前提下,启动cman,然后开放防火墙端的1630端口(看cman开的是什么端口啦),最后在客户端的tnsnames.ora文件中添加:
cmantest = (description = (address_list = (address = <- first address is to CMAN (protocol=tcp) (host=hostname or ip of cman) (port=1610) ) (address= <- second address is to Listener (protocol=tcp) (host=hostname or ip of listener) (port=1521) ) ) (connect_data = (sid = sidname)) (source_route = yes)

]]> http://blog.donews.com/leiyan/archive/2007/01/09/1111174.aspx/feed 2
ajax自学备忘录 http://blog.donews.com/leiyan/archive/2006/04/04/811640.aspx http://blog.donews.com/leiyan/archive/2006/04/04/811640.aspx#comments Tue, 04 Apr 2006 08:03:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2006/04/04/811640.aspx 1。javascript提交使用GET时会下载XML数据文件并缓存在本地,对无需实时同步的数据尽量用GET,这样随算客户端再刷新,也不会再次读取服务端XML文件

2。对需要GET但又需要实时性强的,可使用在GET后加唯一参数解决(此时推荐使用post,详见3),如:

     ajax.open("GET",Filer,true);

     get = get + "&date=" +new Date().getTime();

     ajax.send(GET);

3。javascript提交使用post,经测试 不会缓存到本地,实时性强,使用方法基本和GET相同,如:

      ajax.open("POST",Filer,true);

      ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

      ajax.send(post);

4。因为可能发生javascript已经开始绘制,但页面还没有载入完成,导致页面载入完成前,javascript已经结束工作,页面停留在没有数据显示的状态,所以尽量避免onload事件。

]]>
http://blog.donews.com/leiyan/archive/2006/04/04/811640.aspx/feed 0
Oracle kill session http://blog.donews.com/leiyan/archive/2005/12/14/657897.aspx http://blog.donews.com/leiyan/archive/2005/12/14/657897.aspx#comments Wed, 14 Dec 2005 07:57:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2005/12/14/657897.aspx SQL> select username,sid,serial# from v$session;

SQL> alter system kill session 'sid,serial#';

]]>
SQL> select username,sid,serial# from v$session;

SQL> alter system kill session ’sid,serial#’;

]]>
http://blog.donews.com/leiyan/archive/2005/12/14/657897.aspx/feed 0
男孩变成男人的标志 http://blog.donews.com/leiyan/archive/2005/10/04/576521.aspx http://blog.donews.com/leiyan/archive/2005/10/04/576521.aspx#comments Tue, 04 Oct 2005 09:12:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2005/10/04/576521.aspx   
  会哄妈妈开心
  
  不轻易喝醉
  
  不轻易对人说要戒烟,反反复复只会让人觉得言而无信
  
  和她在一起无话可说时,懂得伸手去揽她的肩
  
  失恋的雨夜,自己回家品红酒听肖邦,而不是去站在她楼下淋雨折磨她
  
  不怕孤单
  
  情人节和生日记得给前女友祝贺,仅此而已
  
  女生倒在你怀里哭诉衷肠后,第二天一切正常,不为所动
  
  不轻易发誓,不轻易相信誓言
  
  忘记她的誓言
  
  不轻易愤怒
  
  学会宽恕,分享
  
  不对女生说下流笑话
  
  会送恐龙回家
  
  和美女ONS后,不再纠缠她,拿的起放的下
  
  接受比自己小但有才华的人超过自己
  
        不和父亲顶嘴
  
  会哄妈妈开心
  
  不轻易喝醉
  
  不轻易对人说要戒烟,反反复复只会让人觉得言而无信
  
  和她在一起无话可说时,懂得伸手去揽她的肩
  
  失恋的雨夜,自己回家品红酒听肖邦,而不是去站在她楼下淋雨折磨她
  
  不怕孤单
  
  情人节和生日记得给前女友祝贺,仅此而已
  
  女生倒在你怀里哭诉衷肠后,第二天一切正常,不为所动
  
  不轻易发誓,不轻易相信誓言
  
  忘记她的誓言
  
  不轻易愤怒
  
  学会宽恕,分享
  
  不对女生说下流笑话
  
  会送恐龙回家
  
  和美女ONS后,不再纠缠她,拿的起放的下
  
  接受比自己小但有才华的人超过自己
  
  有2年期的人生目标

]]>
http://blog.donews.com/leiyan/archive/2005/10/04/576521.aspx/feed 0
Oracle 表空间回收 http://blog.donews.com/leiyan/archive/2005/09/15/554690.aspx http://blog.donews.com/leiyan/archive/2005/09/15/554690.aspx#comments Thu, 15 Sep 2005 04:11:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2005/09/15/554690.aspx 创建UNDOTBS2表空间

切换到UNDOTBS2空间

alter system set UNDO_TABLESPACE=UNDOTBS2;

drop tablespace UNDOTBS1;

创建UNDOTBS1表空间

切换回UNDOTBS1空间

alter system set UNDO_TABLESPACE=UNDOTBS1;

删除UNDOTBS2表空间;

]]>
创建UNDOTBS2表空间

切换到UNDOTBS2空间

alter system set UNDO_TABLESPACE=UNDOTBS2;

drop tablespace UNDOTBS1;

创建UNDOTBS1表空间

切换回UNDOTBS1空间

alter system set UNDO_TABLESPACE=UNDOTBS1;

删除UNDOTBS2表空间;

]]>
http://blog.donews.com/leiyan/archive/2005/09/15/554690.aspx/feed 0
SQL分析 http://blog.donews.com/leiyan/archive/2005/07/28/484632.aspx http://blog.donews.com/leiyan/archive/2005/07/28/484632.aspx#comments Thu, 28 Jul 2005 01:48:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2005/07/28/484632.aspx connect sys
@$ORACLE_HOME/rdbms/admin/utlxplan.sql
create public synonym plan_table for plan_table;
grant all on plan_table to public;

@$ORACLE_HOME/sqlplus/admin/plustrce/plustrce.sql
grant plustrace to public;

set autotrace trace;

]]>
http://blog.donews.com/leiyan/archive/2005/07/28/484632.aspx/feed 0
rman 异地恢复 http://blog.donews.com/leiyan/archive/2005/07/27/483780.aspx http://blog.donews.com/leiyan/archive/2005/07/27/483780.aspx#comments Wed, 27 Jul 2005 08:45:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2005/07/27/483780.aspx rman全备份

把rman备份目录cp到相应目录下

目标机启动

startup mount

set dbid

rman target sys/sys@目标机 catalog rman/rman@rman

RMAN> run {  
2> allocate channel c1 type disk;
3> restore database;
4> recover database;
5> sql ‘alter database open’;
6> release channel c1;
7> }

rman生成控制文件

rman  target /

list backup of controlfile; 查找包含控制文件备份的文件

restore controlfile to ‘/tmp/control.ctl’ from
‘上面命令列出的文件名’;

alter database mount;

alter database resetlogs

]]>
http://blog.donews.com/leiyan/archive/2005/07/27/483780.aspx/feed 0
data gurad手记 http://blog.donews.com/leiyan/archive/2005/07/27/483352.aspx http://blog.donews.com/leiyan/archive/2005/07/27/483352.aspx#comments Wed, 27 Jul 2005 05:28:00 +0000 雷炎 http://blog.donews.com/leiyan/archive/2005/07/27/483352.aspx 在primary 和standby两台机器上安装oracle 都已software only方式安装

然后在primary机器上安装库,激活archive log

在primary上

alter system switch logfile

shutdown immediate

tar czvf oradata.tar.gz /home/oracle/oradata
tar czvf admin.tar.gz /home/oracle/admin
然后我就cp到了standby的相应目录上

启动primary库

alter database create standby controlfile as ‘/home/oracle/standby.ctl’
create pfile=’/home/oracle/initora9.ora’ from spfile

把这两个文件cp到standby的相应目录上

修改initora9.ora的

*.control_files=’/home/oracle/oradata/ora9/standby.ctl’
添加了
standby_archive_dest=’/home/oracle/oradata/ora9/standbyarch’
*.fal_server=’PRIMARY’
*.fal_client=’STANDBY’
*.standby_file_management=’AUTO’

然后在standby上创建监听和net8

在primary上创建standby的net8

用tnsping测试两个库是否可以通讯

启动standby数据库

sqlplus " / as sysdba"

startup nomount pfile=’/home/oracle/initora9.ora’

alter database mount standby database

alter database recover managed standby database disconnect from session

到primary数据库中

alter system set log_archive_dest_2=’service=standby mandatory reopen=60′;

alter system switch logfile;

在standby系统上执行

tail -f /home/oracle/admin/ora9/bdump/alter*.log

查看是否归档

alter database recover managed standby database cancel;

alter database open read only;

此时可以登陆standby来查看是否已经同步

恢复standby

alter database recover managed standby database disconnect from session;

]]>
http://blog.donews.com/leiyan/archive/2005/07/27/483352.aspx/feed 0