Chinaunix首页 | 论坛 | 博客
  • 博客访问: 91761895
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: DB2/Informix

2008-05-31 16:29:39

管理磁盘空间

数据库服务器使用以下物理单元管理磁盘空间:

  • 页面
  • 区段(Extent)
  • Blobpage
  • Sbpage


块是分配给服务器的磁盘或物理空间单元。块可以是裸设备(特殊字符设备)或 UNIX 熟文件。当向服务器分配块时,需要指定下面三个值:

  1. 路径名:用于块的文件路径或裸设备名称。
  2. 偏移量:物理距离,从设备的初始部分到设备开始读写的位置,单位为 KB。如果创建使用熟文件的块,则偏移量为 0;非零偏移量只用于裸设备。
  3. 大小:指定分配用于裸设备的空间大小,单位为 KB,起始量为偏移量或块所使用的 UNIX 文件大小。

服务器的逻辑限制为 32,767 块。然而,UNIX 内核将限制进程可以打开的文件数,该限制将取代服务器限制。

页面是服务器使用的基本 I/O 单元。从 IDS Version 10 开始,页面的大小不再根据产品平台确定。任何在根 dbspace 后创建的块/dbspaces 的页面大小范围从 2K 到 16K 之间,使用多个默认页面大小。如果现有页面不能存放指定大小的页面,将创建一个缓冲池。

磁盘中连续的物理页面集合。表空间的大小按照区段单元分配。表的区段大小在创建表时指定。

Blobpage 是存储在 blobspace 中的 blob 数据类型的基本存储单元。可将 blobpage 的大小配置为系统页面大小的若干倍。

sbpage 是数据库服务器用来存储 sbspace 内的智能大对象(smart large objects)的页面类型。与 blobpage 不同,sbpage 不能够进行配置。sbpage 的大小与数据库页面大小相同。





回页首


数据库服务器使用以下逻辑单位存储数据:

  • Dbspace
  • Blobspace
  • Sbspace
  • Tblspace


Dbspace 是一个或多个用于存储数据库和表的块的逻辑组合。每个 dbspace 必须至少分配了一个块。

blobspace 是一个逻辑存储单元,由一个或多个只存储有 TEXT 和 BYTE 数据的块组成。数据库服务器将存储在 blobspace 中数据直接写入磁盘。该数据并不经过共享内存驻留区。

sbspace 是一个逻辑存储单元,由一个或多个存储智能大对象的块组成。智能大对象包括 BLOB、CLOB 和用户定义数据类型(UDTs)。

Tblspace 是为存储一个 dbspace 中特定表或索引信息而分配的所有区段的集合。tblspace 表示的空间不一定是连续的,而任何区段表示的空间则一定是连续的。



                    
onspaces
-c  
-d  
-k   
-m   
-o    
-p   
-s   
-t   
where  
      spacename is the name of the dbspace to be created. 
      pagesize is non-default page size for the new dbspace. 
      mpathname is mirror pathname 
      moffset is mirror offset    
      offset is offset into the device in KB 
      pathame is Path to the initial chunk  
      size is Size of initial chunk in KB 
      -t indicates if the dbspace created is temporary.
Example : To create a 1-million KB mirrored dbspace dbspace1 with an offset
of 200,000KB for initial(Primary) chunk and an offset of 450,000 for the 
mirrored chunk.

onspaces -c -d dbspace1 -p /dev/rdsk/device1 -o 200000 -s 1000000 -m 
/dev/rdsk/device2 450000



                    
onspaces
-c 
-b   
-g  
-m  
-o  
-p  
-s  

where spacename is the name of the blobspace to be created.
      blobpagesize is Blobpage size in number of disk pages.
      mpathname is mirror pathname.
      moffset is mirror offset.
      offset is Offset into the device in KB 
      pathname is Path to the initial chunk 
      size is Size of initial chunk in KB 
Example : To create a 1-million KB mirrored blobspace blobsp1 
with an offset of 200,000KB for both initial(Primary) and 
mirrored chunk and a blobpage size of 100KB ( 2K system page size ) .

onspaces -c -b blobsp1 -g 50 -p /dev/rdsk/device8 -o 200000 -s 1000000 -m 
/dev/rdsk/device9 200000




                    
onspaces
-c 
-S   
-m  
-o  
-p  
-s  
-t 
-Ms 

可使用 onspaces 工具在系统命令行中删除 dbspace、blobspace 或 sbspace。在删除 dbspace 之前,必须先要删除其中创建的所有数据库和表。

在删除 blobspace 之前,必须先要删除含有引用该 blobspace 的 TEXT/BYTE 列的表。



                    
Example : To drop the dbspace dbspace1.

onspaces -d dbspace1

可使用 onspaces 工具向 dbspace 或 blobspace 添加块。清单 6 展示了使用 onspaces 工具向 dbspace 添加块使用的参数:



                    
onspaces
-a  
-m   
-o    
-p   
-s   
 
where  
      spacename is the name of dbspace or a blobspace to which chunk needs 
      to be added.
      mpathname is mirror pathname 
      moffset is mirror offset    
      offset is offset into the device in KB 
      Path to the device or filename of the chunk
      Size of the chunk in KB
      
Example : To add a 500,000 KB mirrored chunk to dbspace2 with a 100,000 KB offset.

onspaces -a dbspace2 -p /dev/rdsk/device4 -o 100000 -s 500000


可使用 onspaces 向 sbspace 添加块。清单 7 展示了使用 onspaces 工具向 sbpace 添加块使用的参数:



                    
onspaces
-a  
-m   
-o    
-p   
-s   
-Ms 
-Mo 
-U  
 
where  
      spacename is the name of sbspace to which chunk needs to be added.
      mpathname is mirror pathname 
      moffset is mirror offset    
      offset is offset into the device in KB 
      Path to the device or filename of the chunk
      Size of the chunk in KB
      metasize is Size of the sbspace metadata area to be allocated in the 
      new chunk in KB .
      metaoffset is the Offset of the metadata area into the new chunk in KB 
      -U Indicates that the new chunk is to contain only user data 
      
Example : To add a 100,000KB mirrored chunk to the sbspace named sbspace1 with an 
offset of 20,000 KB for both initial and mirrored chunks and 
metadata size of 750KB and 1000 KB offset .

onspaces -a sbspace1 -p /dev/rdsk/chunk6 -o 20000 -s 100000 -m 
/dev/rdsk/chunk7 -Ms 750 -Mo 1000






回页首


添加了两个新的内置 SQL 管理 API 函数,通过 SQL 的 EXECUTE function 语句,模拟 Dynamic Server 的不同管理命令行工具,可以完成远程管理任务。

ADMINTASK 函数为 Dynamic Server 的管理命令行工具提供了一个 SQL 接口。这些内置函数只在每个 Dynamic Server 实例的 sysadmin 数据库中做了定义,并且只能被用户 informix 调用。

当用户连接到 Dynamic Server 实例的 sysadmin 数据库时,可远程调用这些函数。

ADMINTASK 函数的每个调用会生成两个结果:

  1. 执行指定的命令任务,通常是模拟一些管理工具
  2. 将新行插入到 sysadmin 数据库的 command_history 表中

TASK 函数返回说明返回状态的字符串。ADMIN 函数返回一个整数说明返回状态,这是到 command_history 表的链接。



                    
EXECUTE FUNCTION task('create dbspace','dbs1', '/dev/rdsk/device1 ', '200000', 
'1000000');
Output : (expression)  Space 'dbs1' added.
				



                    
EXECUTE FUNCTION task ('drop dbspace', 'dbs1');
Output : (expression)  Space 'dbs1' dropped.
** WARNING **  A level 0 archive will need to be done before any chunks from
DBspace dbs1 can be reused (see Dynamic Server Administrator's manual).



                    
EXECUTE FUNCTION task ( 'add mirror', 'dbs1', '/dev/rdsk/device1','200000', 
'/dev/rdsk/device2', '450000');
Output: (expression)  Mirror chunk '/dev/rdsk/device2' added to space 'dbs1'




                    
EXECUTE FUNCTION task('create blobspace ','blobsp1', '/dev/rdsk/device8 ', '50', 
'200000', '1000000');
Output: (expression)  Space 'blobsp1' added.




                    
EXECUTE FUNCTION task('create blobspace ','blobsp1', '/dev/rdsk/device8 ', '50', 
'200000', '1000000');
Output: (expression)  Space 'blobsp1' added.

阅读(844) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~