2007-06-26 Tue
昨天完成了《循序渐进Oracle》一书第三章的最后校订工作。
第三章讲的是关于字符集的内容,其部分内容来自以前的一篇文章,但是在这一稿中做了大量的修改,增加了很多重要的内容,这些补充使得这一章对于字符集的讲解更加深入、透彻、容易理解。
这些补充内容,很多来自最近的理解,其中包括了自定义字的存储,以及通过自定义来理解原来较为复杂的字符集转换知识;这一章新增加了对于常见"靠"字乱码的分析,相信类似的情况很多朋友都遇到过;新章节中还加入了对于字符文件作用的探讨。
希望通过这一章节,对于字符集的问题能够有进一步的阐释,这一版的成稿距离最初写作这篇文章已经三年有余,正是因为这次重写和补充也使得我个人对于字符集有了更深一步的了解和认识。
下图就是这一章的目录结构:
请大家指正。
-The End-
相关文章|Related Articles
评论数量(1)|Add Comments
本文网址:http://www.eygle.com/archives/2007/06/stepbs_oracle_chapter3_index.html
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
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!
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 ]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.

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.
凌晨2:22分,将所有的应用全部切换到应该去的地方。
然后,等ibm的工程师对阵列作操作。等着等着,一个人在办公室太无聊,到下面和开发的人聊聊天,然后找ibm的哥们扯扯淡。
再次回到办公室,发现已经4:40了。
突然发现,杭州已经天亮了。杭州的天,亮的可真够早的。也就是说,今天是肯定没得睡了。只能等白天看能不能睡得着了。或许会睡不着吧,我估计,因为我一般都没有白天睡觉的习惯,不过今天晚上应该能睡的很好了。
来杭州这么多年,从来没有看到过杭州的黎明。现在,大街上,很安静,居然能听到小鸟的叫声,看来杭州的环境真的是不错,要知道,上班的地,可是在市中心。
嗯,无论如何,还要等ibm的哥们通过他们日本的工程师再通过美国的工程师来解决阵列的问题。这阵列也不能说坏就坏,说不起来就不起来吗。这样折腾下去,希望8点前,我能回到家。
因为,我需要回家。我已经接近24小时没有回家了。想洗个澡,吃点早餐,然后好好的睡一下。或许我就不亚健康了。
杭州的早晨,很安静,也很安逸。不知道昨天晚上,又会有多少人象我一样,为了工作,在杭州一个晚上没睡的。
生活,本该如此。
在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总量,可以通过如下命令查看
- SQL> select sum(value)/1024/1024/1024 "SIZE(G)" from v$SGA;
- SIZE(G)
- ----------
- 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后台进程,一个负责页面转换的进程,当发现内存不够的时候,会直接杀掉运行的进程。
够狠,也够烂。
上个周末,在植物园拍的小小花朵,就像一朵小小的太阳花。
可惜镜头略有不足,拍不出更好的效果。
整个花直径大约1厘米,这是最小光圈拍出来的:
-The End-
相关文章|Related Articles
评论数量(10)|Add Comments
本文网址:http://www.eygle.com/archives/2007/06/little_sun_flower.html
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.
因为自己的无能为力,丢失了一个朋友.
我能说什么列,能作什么列.只能对那个朋友说,希望你能找到你要的生活,也希望,我的出现,没有打扰你的生活,没有给你的生活带来太多的影响.无论如何,还是那句话吧.希望所有的朋友(包括曾经的朋友)都能过的好.
我承认,最近精神状态非常的不好,整天浑浑噩噩的,很多事情都没有能够作到最好.生活上,工作上,都没有办法作到最棒的自己.
虽然我很伤心,可是我却不能喝酒,我现在真的很想让自己喝醉,什么都不要管,可是,我不能这么作,因为今天晚上11点的工作非常重要,必须继续,而且不能出现任何差错,那么,加油吧,David,你一定能作到最棒.
2007-06-25 Mon
2007-06-24 Sun
AnySQL.net
DBA notes
Oracle & Starcraft
eagle's home
Oraus.net
AnySQL.net English
Oracle Scratchpad
Oracle Life
OracleDBA Blog
Photos from dbanotes
Chanel [K]
xzh2000的博客
Oracle Security Blog
ERN空间
Eddie Awad's Blog
MySQL Performance Blog
The Tom Kyte Blog
del.icio.us/fenng/oracle
AIXpert
O'Reilly Databases
Red Hat Magazine
DBASupport
DB2 Magazine 中文版
developerWorks : AIX 专区的文章,教程
Pythian Group Blog
车东[Blog^2]
blue_prince
玉面飞龙的BLOG
此生 今世
人生就是如此
Orange Tiger 木匠 的 web log
生活帮-LifeBang
Fenng's shared items in Google Reader
Hey!! Sky!
jametong's shared items in Google Reader
dba on unix
Oracle Notes Wiki
Welcome to brotherxiao's Home

