123
 123

2007-06-26 Tue

19:12 《循序渐进Oracle》一书第三章目录 (2711 Bytes) » Oracle Life

©作者:eygle 发布在 eygle.com

昨天完成了《循序渐进Oracle》一书第三章的最后校订工作。

第三章讲的是关于字符集的内容,其部分内容来自以前的一篇文章,但是在这一稿中做了大量的修改,增加了很多重要的内容,这些补充使得这一章对于字符集的讲解更加深入、透彻、容易理解。
这些补充内容,很多来自最近的理解,其中包括了自定义字的存储,以及通过自定义来理解原来较为复杂的字符集转换知识;这一章新增加了对于常见"靠"字乱码的分析,相信类似的情况很多朋友都遇到过;新章节中还加入了对于字符文件作用的探讨。

希望通过这一章节,对于字符集的问题能够有进一步的阐释,这一版的成稿距离最初写作这篇文章已经三年有余,正是因为这次重写和补充也使得我个人对于字符集有了更深一步的了解和认识。

下图就是这一章的目录结构:

请大家指正。

-The End-

相关文章|Related Articles

评论数量(1)|Add Comments

本文网址:

14:09 How to build a dirt easy home NAS server using Samba (11912 Bytes) » Red Hat Magazine

A huge problem in most digital households is a growing collection of data without an easy way to share it and store it in one spot. Music. Movies. Pictures. Documents, backups, operating system images. Wow! Where do you put all of this stuff?

You’re in luck, because it is quite simple to setup a Network Attached Storage (NAS) device that any operating system can mount and write to on the network. By using Samba, you can turn a Fedora server into a common shared storage medium for Mac OS X, Linux®, and Microsoft® Windows®. And it gets even better. With the lower cost of disk drives, it is quite possible to setup a 1-2 TB disk array as your Samba storage pool. How about that for a movie depot?!

If you’re a home user, you might only care about .001% of the configuration options of Samba. Basically, you would like a volume to mount on all of the computers in your house, and you would like to use it for file sharing. This share should only be accessible to a computer on your network. For home network security, you really only need an IP restricted share without authentication. Fortunately, this is one of the easiest possible configurations.

Keep in mind that this assumes you’re behind a firewall, although we will still be restricting the share to the local network. As a rule, all home networking should be done on a private network behind your firewall. The reason is simple; everyone makes mistakes and you may be in a hurry someday and skip a step and allow the whole world access to your home network.

With the security concerns behind us, let’s get to work.

Getting started

Configuring Samba can be daunting, but it doesn’t have to be. Ignore the default configuration file and start over from scratch. The trick to configuring Samba quickly is to use only the configuration options you really need. But first, let’s set up an account for all of your Samba users, create a “sharepoint,” and give it proper permissions.

Preparing your server for SMB hosting

1. Create an account just for your SMB user.

As root, issue the following commands:

useradd fileserver901
passwd fileserver901

(This is up to you. Give the account a secure password. Number and special characters are always a good combination.)

2. Create a share folder.

mkdir /sharepoint

3. Change permissions on the share.

chown -R fileserver901:fileserver901 /sharepoint
Tip
Samba uses the underlying UNIX® authorization and account mechanisms. In order to set up Samba, we have to create or reuse a directory and give our Samba user account access to it. If we did not set these permissions, then the volume would be mountable, but no one could write or read from the volume.

Setting up and configuring smb

Next we are going to set up and configure Samba to share out the directory we just set up and force all anonymous users to become the user fileserver901. It is important to note that the underlying Linux file permission structure must belong to our user, fileserver901.

1. Check to see if samba is installed.

rpm -q samba

You should get something back like:

samba-3.0.10-1.4E.11

If not, you need to install Samba:

yum install samba

2. Make a backup of your current samba configuration file.

cp /etc/samba/smb.conf /etc/samba/smb.conf.original

3. Delete everything in the file and paste in the below sample config file.

You can accomplish this by using your favorite text editor like vim or emacs:

vim /etc/samba/smb.conf

(note the only item to change will be your subnet value in the hosts allow line)

[global]rnworkgroup = homernnetbios name = fedorarnsecurity = share hostsrnallow = 192.168.0.0/24rnrn[share]rncomment = Home File Serverrnpath = /sharepointrnforce user = fileserver901rnforce group = fileserver901rnguest ok = yesrnread only = no

4. Test the syntax of the /etc/samba/smb.conf file.

Make sure you have your configuration correct:

testparm /etc/samba/smb.conf

You should see something similar to:

"Loaded services file OK."

5. Start the smb service and tell it to run on boot.

chkconfig smb on service smb start

Congrats, smb is now working!

Tip
In Step 3, we copied over an “anonymous read/write configuration” that will allow all machines on the 192.168.0.0/24 subnet to access the volume. Every account that connects to Samba will be “forced” to become user/group=fileserver901. As long as there is an external firewall in front of your home network, then this is a perfectly acceptable configuration as it offers two layers of security. Layer 1 is the firewall, which should not allow any incoming traffic. Layer 2 explicitly allows only your local subnet access. This is an ideal home network setup, but not acceptable for a small office or a corporation, obviously.

Let’s quickly analyze the configuration file step by step:

[global] (signifies security parameters)
workgroup = home (names a windows workgroup name)
netbios name = fedora (our netbios name)
security = share (takes on permissions from the share, which we set earlier)
hosts allow = 192.168.0.0/24 (only allows this subnet to connect i.e. 192.168.0.1192.168.0.254)

[share] (Signifies the name of our share when mounted. You can change to anything you like.)
comment = Home File Server (creates share point comments)
path = /sharepoint (The full path the volume you want to share. Note if you want to share more than one volume, copy the “share” section and alter accordingly.)
force user = fileserver901 (forces all users of this mount to become this user and obtain access to whatever this user has access to)
force group = fileserver901 (forces all users of this mount to become this group and obtain access to whatever this group has access to)
guest ok = yes (allows anonymous accounts to access, which is how we can connect without a password)
read only = no (allows us to write to the volume. If you set this to yes, you could make this an anonymous “read” only volume)

Connect from Linux, Mac, and Windows

This is the fun part. Now that we have our server running, we should be able to mount this volume from any operating system that supports SMB, which is most. I will show you how to mount our volume on Linux, Mac OS X, and Windows 2003 Server.

Mac OS X Tiger

1. Go to the Finder menu and select “Connect to Server” or press Apple key + “k”.

2. In the server address bar, type in smb://192.168.0.101 (or whatever the address is of your home smb server).

3. Select connect. When the dialog box appears, click on “Ok” for the “share.”

4. A dialog box will appear with a workgroup, name, and password. Just ignore it and press ok again.

5. A volume named share will appear on your desktop.


Windows 2003 Server

(Note: this should be almost identical for most other Windows versions.)

1. Open the Windows Explorer.

2. Type in: \\192.168.0.101\share (or whatever the address is of your home smb server).

3. You now have read/write access to the volume.


Red Hat® Enterprise Linux 5

(Note: this should be identical for any newer Gnome installation.)

1. Go to Places and select “Connect to Server.”

2. Under Service Type, select “Windows Share.”

3. In the server address box, type in 192.168.0.101 (or whatever the address is of your home smb server).

4. In the share box, type share

5. A volume named share will appear on your desktop.


Summary

Getting cross platform file sharing working with Samba can be incredibly complicated, unless you focus on just the components of Samba you need. Most of Linux is like a swiss army knife, it can do just about anything. The trick to mastering Linux is to have the ability to ignore 99% of the options and to focus on the task at hand. We wanted to set up cross-platform file sharing via smb, not set up a Samba Domain Controller. The next step for the home user is to ponder how big of a NAS to set up. If you plan ahead, you could buy several large disks and stripe them together for redundancy and speed, and store all of your music and videos on it. The possibilities are endless.

[read this post in: ar de es fr it ja ko pt ru zh-CN ]
14:00 Seeking MySQL backup console feedback (1032 Bytes) » O'Reilly Databases

We are working on Zmanda Management Console for our MySQL backup product line: Zmanda Recovery Manager (ZRM) for MySQL. ZRM for MySQL is an enterprise backup and recovery solution for MySQL.

Zmanda Management Console for MySQL backup

We are looking for MySQL administrators in San Francisco bay area who would be interested in providing functionality and usability feedback for the user interface. We are particularly interested in MySQL administrators responsible for implementing backup solution for their MySQL databases. Please send an email to me (paddy-at-zmanda-dot-com) with your availability and why you would meet our requirement. We will pay a small stipend for your time.

13:55 杭州的早晨 (1458 Bytes) » OracleDBA Blog

凌晨2:22分,将所有的应用全部切换到应该去的地方。

然后,等ibm的工程师对阵列作操作。等着等着,一个人在办公室太无聊,到下面和开发的人聊聊天,然后找ibm的哥们扯扯淡。

再次回到办公室,发现已经4:40了。

突然发现,杭州已经天亮了。杭州的天,亮的可真够早的。也就是说,今天是肯定没得睡了。只能等白天看能不能睡得着了。或许会睡不着吧,我估计,因为我一般都没有白天睡觉的习惯,不过今天晚上应该能睡的很好了。

来杭州这么多年,从来没有看到过杭州的黎明。现在,大街上,很安静,居然能听到小鸟的叫声,看来杭州的环境真的是不错,要知道,上班的地,可是在市中心。

嗯,无论如何,还要等ibm的哥们通过他们日本的工程师再通过美国的工程师来解决阵列的问题。这阵列也不能说坏就坏,说不起来就不起来吗。这样折腾下去,希望8点前,我能回到家。

因为,我需要回家。我已经接近24小时没有回家了。想洗个澡,吃点早餐,然后好好的睡一下。或许我就不亚健康了。

杭州的早晨,很安静,也很安逸。不知道昨天晚上,又会有多少人象我一样,为了工作,在杭州一个晚上没睡的。

生活,本该如此。

09:31 支持韩寒(代海岩发)韩寒 (5082 Bytes) » Fenng's shared items in Google Reader
     前几天韩寒写了篇文章(http://blog.sina.com.cn/u/4701280b01000a85)来支持我,我很感谢他,事实上,我感谢所有人,男的,女的,但我尤其要感谢男的。
     不想,他也碰到这样的问题,(http://news.sina.com.cn/c/edu/2007-06-26/092512092905s.shtml)有网友揭露,韩寒找了一个枪手,达三年之长。我很不满,因为报道里,他找的是一个男枪手。这位枪手的名字叫马日拉,是他的一个朋友。关于这位姓马的朋友,我日后会解决。据记者说,这位爆料的网友,名字叫“梦七上四”,我当时就判断他是郭敬明也就是小四的粉丝。因为他的旧书《一梦三四年》在我们行业内,就简称为“梦七”,上四就不用我说了,上了小四。我马上打电话给郭敬明,说,你的粉丝怎么回事?你难道不知道我和韩寒的关系?你不管好你的粉丝,来挑拨我们,你以为你就能得逞吗?我不管你看中的是我和韩寒之间的谁,我们都不会对你产生感情——除非你把和极地阳光的事清弄清楚了。
    郭敬明只是默默的说了一声,我懂。
    说正题,其实找枪手和包二奶一样,在我们这个圈子里是很多的,而且现在流行合二为一,直接包个二奶枪手,即能用做打字机,又能用做打飞机。但是,我海岩肯定不会做这样的事情,因为我就不喜欢奶嘛。不过,我和韩寒的合作关系是很紧密的,在我前几天展示1000万字的手稿的时候,我就很担心的给他电话,如果有有一天,有人说你找枪手,那怎么办,况且你没有手稿,你是用电脑打字的。
    韩寒回答说,没关系,我早就知道有这么一天,树大招疯子,所以,每次我打开电脑写作的时候,我就在旁边用DV拍着,到现在为止,我已经累积了1000盘录象带。过几天我就开个记者招待会,学你一样,向记者当面播放着1000盘合计2000个小的录象资料,请参加本次招待会的记者自带干粮和帐篷。别忘了手机充电器。谢绝体育记者,因为我怕我的招待会完了,奥运会也结束了。
    我一听,再次被韩寒的智慧和未雨绸缪所倾倒,我说,我会来探班的,你喜欢吃什么?
    韩寒回答说:只要你人来就可以了,我比吃什么都开心。
    我问:那你的招待会打算什么时候召开?
    韩寒回答说:我得先把这1000盘带子看一遍,因为难保我在写的时候突然有个姑娘来探望,有个什么事都拍在里面,我就成黄健中导演了。
    听到有女孩子去看过他,我很难过。我想,我是不会去韩兄的发布会了,但是,我还是要写这篇文章挺他,因为他也挺过我,至少这样,我们互相都挺了。
 
                                           2007年6月26日  海岩于海盐
 
 
    真是对不住海岩了。拿您来开个玩笑。其实有人代写文章这事真的莫名其妙,我这样明显的文字风格都能被说有枪手,那些没风格的大作家们怎么办啊。以后记者写新闻的时候最好要动点脑子,求证一下。比如这次爆料的这个人,我去他的博克看了一下,博克名字叫“狂想”,已经表明了他的类型。第一篇是写我找枪手的,他说他自己是一个资深的出版界的圈内人,第二篇就是《我很喜欢收集班上女同学的腋毛,怎么办?》,资深出版人还在上学呢,真有为。再往下还有《我的美丽外教女老师是否想迷奸我?》《去参加林志玲的见面会后我感觉她爱上了我,怎么办?》《泽塔琼斯曾经瞒着老公来中国找我》《我喜欢把偷来的班级里女同学的内裤套在头上睡觉》,基本上我就不需要再解释什么了。
    所以,记者一定要弄明白小说和新闻的区别,不能随便论坛里找一个帖子就拿来当新闻,然后不负责的写道是网友爆料。如果这样,新闻就太好写了,我注册个帐号可以说全天下写文章的都是找枪手的,一天换一个作家爆料,想必用电脑写作的作者也拿不出证据来反驳吧。一个作者写东西挺花脑子的,记者论坛上随便整理一个帖子当新闻就可以把人家逼到跳到黄河洗不清的境地,而且现在的读者还都特别相信这些“爆料”,当事人走到哪都要背黑锅,这个已经和娱乐精神完全不搭界了。别逼的中国的作者们以后只能在公证处写小说啊。
07:59 Simplified User Maintenance (146 Bytes) » DBASupport
Learn how to loop through a list of names, create the userids and grant necessary permissions when creating multiple users in an Oracle database.
07:10 怎么在AIX 5L上pin住Oracle SGA (4356 Bytes) » dba on unix

在aix上,我们可以将oracle SGA pin在内存中,防止这部分内存交换。所以,通过pin住oracle SGA,能带来很大的性能好处。

如果想要正确的pin住内存,涉及到2个OS内核参数与一个oracle init参数:

1、aix参数v_pinshm=1,默认是0,表示aix将支持pin住内存,设置方法为

#vmo -p -o v_pinshm=1

2、aix参数maxpin%=内存百分比,默认80%,表示支持的最大的可pin住内存的比例,设置方法为

#vmo -p -o maxpin%=90

3、oracle参数LOCK_SGA=true,表示oracle将使用这部分被pin住的内存,其实就是告诉oracle使用另外一种内存调用方法。

因为这部分pin住的内存不仅仅是oracle在使用,aix内核也可能需要用到这部分内存,所以,我们不能设置SGA超过如下2个公式的范围:

1、SGA < 总内存*(maxpin%-10%),如果是默认值,则SGA不能超过总内存的70%

2、OS的pin住内存的总量(稳定运行时的总量,会随SGA大小而变化) < 总内存*(maxpin%-5%),如果是默认值,则pin住的内存总量,不能超过总内存的75%

至于Oracle的SGA总量,可以通过如下命令查看

  1. SQL> select sum(value)/1024/1024/1024 "SIZE(G)" from v$SGA;
  2.  
  3.    SIZE(G)
  4. ----------
  5. 71.2681394

至于被pin住的内存总量,可以通过OS的命令svmin来查看

#svmon -G

                   size      inuse       free        pin    virtual
    memory     27394048   23520958    3873090   20424376   20884173
    pg space   16777216      41932
    ......

注意,以上pin住的部分,是表示4k大小的页面个数(没有使用大页的情况下),那么,折算成内存大小则是20424376*4/1024/1024=77.91G。

那么,如果采用默认的maxpin%设置(80%),我们将需要多大的物理内存呢?

公式1:物理内存 = 71.27/0.7 = 102G

公式2:物理内存 = 77.91/0.75 = 104G

在两者里面取大值,表示我们至少需要104G的物理内存,再去掉其它转换消耗,固定消耗,购买内存起码需要108G。

关于以上2个公式,我还想补充说明一下,在5.2的早些版本中,只需要满足公式1即可,如果实际设置的SGA内存超过了公式1的范围,其实OS也只pin住maxpin%-10%的内存,其它的没有pin住的内存,可能会导致交换的发生,最多是影响性能。

但是,aix 5.2以后的一些版本以及aix 5.3版本,因为不同page size的出现(如64K的page size的大量使用),如果不符合以上的两个公式,最严重的后果就是会导致OS被hang住,其实也就是aix的一个新的psm后台进程,一个负责页面转换的进程,当发现内存不够的时候,会直接杀掉运行的进程。

够狠,也够烂。

06:22 摄影习作-小小的太阳 (1627 Bytes) » Oracle Life

©作者:eygle 发布在 eygle.com

上个周末,在植物园拍的小小花朵,就像一朵小小的太阳花。

可惜镜头略有不足,拍不出更好的效果。
整个花直径大约1厘米,这是最小光圈拍出来的:

-The End-

相关文章|Related Articles

评论数量(10)|Add Comments

本文网址:

06:14 Can Innodb Read-Ahead reduce read performance ? (4883 Bytes) » MySQL Performance Blog

I ran into pretty interesting behavior today. We needed to dump and reload large database and we had pretty good IO subsystem so we started number of mysqldump processes in parallel. Unlike in other case when we did load in parallel, dump in parallel did not increase IO rate significantly and we could still see just about 1.5 average outstanding IO requests to the disk.

Lets look at SHOW INNODB STATUS:

——–
FILE I/O
——–
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: doing file i/o (read thread) ev set
I/O thread 3 state: waiting for i/o request (write thread)
Pending normal aio reads: 256, aio writes: 0,
ibuf aio reads: 0, log i/o’s: 0, sync i/o’s: 0
Pending flushes (fsync) log: 0; buffer pool: 0
112084404 OS file reads, 29836003 OS file writes, 2038246 OS fsyncs
1 pending preads, 0 pending pwrites
286.27 reads/s, 82658 avg bytes/read, 2.96 writes/s, 0.71 fsyncs/s
————————————-
INSERT BUFFER AND ADAPTIVE HASH INDEX
————————————-
Ibuf: size 108931, free list len 64619, seg size 173551,
56290428 inserts, 59538912 merged recs, 3876269 merges
Hash table size 25499819, used cells 1303661, node heap has 1974 buffer(s)
867.08 hash searches/s, 532.42 non-hash searches/s

LOG

Log sequence number 586 10447960
Log flushed up to 586 10447960
Last checkpoint at 586 10264850
0 pending log writes, 0 pending chkp writes
1338030 log i/o’s done, 0.47 log i/o’s/second
———————-
BUFFER POOL AND MEMORY
———————-
Total memory allocated 13917841802; in additional pool allocated 1046272
Buffer pool size 786432
Free buffers 0
Database pages 784458
Modified db pages 361
Pending reads 261
Pending writes: LRU 0, flush list 0, single page 0
Pages read 344728059, created 2867101, written 37374308
1445.95 reads/s, 0.00 creates/s, 3.35 writes/s
Buffer pool hit rate 933 / 1000
————–
ROW OPERATIONS
————–
8 queries inside InnoDB, 3 queries in queue
12 read views open inside InnoDB
Main thread process no. 3956, id 1157658976, state: sleeping
Number of rows inserted 60790248, updated 11571576, deleted 0, read 63850963520
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 24860.96 reads/s

The stats are rather interesting. There are 8 queries inside Innodb and we can see only one pending pread with 256 Pending normal aio reads.

Pending normal aio reads are in fact counted in pages rather than distinct IO requests, so in this case it is likely these are 4 read-ahead requests, 64 pages each.

What seems to be happening (I’m using “seems” as there are no detailed enough stats available) is once thread has issued read-ahead request it has to wait for it to complete. It can’t simply go and read the next page it needs, if the same page is already being read via read-ahead. Now as we’re dumping tables which were inserted in PK order we have relatively sequential IO and so read-ahead is constantly triggered which makes all thread to wait on single read-ahead thread which is unable to keep up.

This does not explain the whole story to me, such as I’d expect read-aheads to complete faster giving much more than 30MB/sec from this RAID system. Also as average read size is some 80KB we have a lot of non read ahead requests happening as well, at least 10 times more than number of read-ahead requests. May be it is poor read-ahead performance plus multiple threads doing scattered O_DIRECT (so no OS read-ahead) single page reads which hurt performance ?

I guess we really should try Mark Callaghan patches to see what happens if we allow multiple read-ahead threads.

I also can’t wait for Christoffer Hall’s work of Linux AIO support to be merged to the mainline.

This also reminds me about other work Christoffer was doing (I was adviseor in this project from MySQL AB side) - to improve how Innodb read-ahead works by having more overlap between requests so thread would rarely need to stall unable to perform any quick IO and unable to progress until scheduled read ahead can be completed. Hopefully this also will be looked at one day.

01:50 无能为力 (809 Bytes) » OracleDBA Blog

因为自己的无能为力,丢失了一个朋友.

我能说什么列,能作什么列.只能对那个朋友说,希望你能找到你要的生活,也希望,我的出现,没有打扰你的生活,没有给你的生活带来太多的影响.无论如何,还是那句话吧.希望所有的朋友(包括曾经的朋友)都能过的好.

我承认,最近精神状态非常的不好,整天浑浑噩噩的,很多事情都没有能够作到最好.生活上,工作上,都没有办法作到最棒的自己.

虽然我很伤心,可是我却不能喝酒,我现在真的很想让自己喝醉,什么都不要管,可是,我不能这么作,因为今天晚上11点的工作非常重要,必须继续,而且不能出现任何差错,那么,加油吧,David,你一定能作到最棒.

 

2007-06-25 Mon

23:18 Oracle Database 11g Overview Presentation » Eddie Awad's Blog
22:43 股市牛歌啊 » Oracle & Starcraft
20:01 UNIX 生产力技巧 » developerWorks : AIX 专区的文章,教程
19:02 北京路透社DBA职位 » Oracle & Starcraft
14:58 Does Slow query log logs all slow queries ? » MySQL Performance Blog