database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
PostgreSQL
Firebird
Oracle
Informix
ㆍSybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
Sybase Q&A 1305 게시물 읽기
No. 1305
ASIQ 에서 dbspace 의 segment 사용량 확인 방법은??
작성자
작성일
2005-09-28 19:58ⓒ
2005-09-28 20:19ⓜ
조회수
5,166

***** 세번째 질문입니다. ******

 

 

sp_iqdbspace

sp_iqspaceused

 

와 같은 명령으로 사용량 파악하는게 아니고...ASE 에서 disk init 후 사용량 확인하는

 

프로시져가 있기에..ASIQ 에서도 적용이 가능한 프로시져가 있는지 궁금합니다.

 

프로시져가 없다면, ASE 에서 사용한 프로시져를 변형하면 될까요?

 

제가 변형이 될지 안될지 모르겠지만..

 

select @alloc = low

from master.dbo.spt_values

where type = "E"

and number = 1

 

spt_values 이게 ASIQ 에는 없다고 나오더라고요..

 

아래 코드는 ASIQ 에서 컴파일은 됩니다.

현재 버젼 : Adaptive Server IQ/12.5.0/050425/P/ESD 16/RS6000MP/AIX 5.1.0/64bit/2005-04-25 17:02:55

 

 

현재 ASE 버전에서 디스크 용량 확인하는 Source 는 다음과 같습니다.

 

(아래코드를 분석치 않아서 정확한지 모르겠습니다. ㅡㅡ;)

 

create procedure sp__iqdisk_device (@devname char(30)=NULL, @dont_format char(1)=null )

as

 

declare @msg varchar(255)

declare @numpgsmb float /* Number of Pages per Megabytes */

declare @tapeblocksize int

 

set nocount on

 

select @numpgsmb = (1048576. / v.low)

from master.dbo.spt_values v

where v.number = 1 and v.type = "E"

 

create table #dev_tbl

(

name char(19),

phyname char(31),

disk_size float null,

status int null,

disk_used float null,

mirrored char(1) null

)

 

insert #dev_tbl

select name=substring(d.name, 1,20),

phyname = substring(d.phyname,1,30),

disk_size=0,

status=status,

disk_used=0,

mirrored=NULL

from master.dbo.sysdevices d

where name=isnull(@devname,name)

 

/* Parallel */

update #dev_tbl

set mirrored="P"

where status & 64 = 64

 

/* Serial */

update #dev_tbl

set mirrored="S"

where status & 32 = 32

 

/* Disabled */

update #dev_tbl

set mirrored="?"

where status & 256 = 256

 

/* Confused */

update #dev_tbl

set mirrored="?"

where status & 32 = 32

and status & 512 != 512

 

/* Add in its size in MB. */

update #dev_tbl

set disk_size = (1. + (d.high - d.low)) / @numpgsmb

from master.dbo.sysdevices d, #dev_tbl

where d.status & 2 = 2

and #dev_tbl.name = d.name

 

update #dev_tbl

set disk_used = ( select sum(size)

from master.dbo.sysusages u, master.dbo.sysdevices d

where d.status & 2 = 2

and vstart between low and high

and #dev_tbl.name = d.name

group by name ) / @numpgsmb

 

update #dev_tbl

set name=rtrim(name)+" ("+mirrored+")"

where mirrored is not null

 

if @devname is null

begin

if @dont_format is not null

begin

print ""

print "****** PHYSICAL DISK DEVICES (Mirror info after device name) ******"

end

end

 

update #dev_tbl set disk_used=0 where disk_used is null

 

if @dont_format is not null

select

"Device Name"=name,

"Physical Name"=phyname,

size=str(disk_size,7,1)+"MB",

alloc=str(disk_used,7,1)+"MB",

free=str(disk_size-disk_used,7,1)+"MB"

from #dev_tbl

where status & 2 = 2

else

select

"Device Name"=substring(name,1,18),

"Physical Name"=phyname,

size=str(disk_size,6,0)+"MB",

alloc=str(disk_used,6,0)+"MB",

free=str(disk_size-disk_used,6,0)+"MB"

from #dev_tbl

where status & 2 = 2

 

if @devname is not null

begin

if exists (select *

from master.dbo.sysdatabases d, master.dbo.sysusages u,

master.dbo.sysdevices dv

where d.dbid = u.dbid

and dv.low <= size + vstart

and dv.high >= size + vstart - 1

and dv.status & 2 = 2

and dv.name=@devname

)

begin

select db_name=d.name,

size = size / @numpgsmb,

usage = convert(char(18),b.name)

from master.dbo.sysdatabases d, master.dbo.sysusages u, master.dbo.sysdevices dv,

master.dbo.spt_values b

where d.dbid = u.dbid

and dv.low <= size + vstart

and dv.high >= size + vstart - 1

and dv.status & 2 = 2

and b.type = "S"

and u.segmap & 7 = b.number

and dv.name=@devname

order by db_name,usage

end

else

begin

if @dont_format is not null

print "****** Device Unused By Any Databases ******"

end

end

go

 

이 글에 대한 댓글이 총 2건 있습니다.

IQ에서는 segment의 개념이 없습니다.

DBSpace라는 개념을 사용합니다.

DBSpace는 Main과 Temporary 두가지 형식만 있습니다.

 

따라서 Segment별로 데이터를 관리하여 저장할 수가 없습니다.

DBSpace를 Main과 Temp 영역으로만 구분하여

여유공간이 있으면 해당 DBSpace에 저장이 됩니다.

또한 Disk Striping = 'ON'으로 설정되어 있는 경우

여러개의 Main DBSpace에 Striping 되어 골고루 저장이 됩니다.

 

간단하게 DBSpace를 확인하는 방법은

sp_iqstatus 입니다.

 

 Main IQ Blocks Used: 247727 of 3276028, 7%=3870Mb, Max Block#: 253536
 Temporary IQ Blocks Used: 97 of 655100, 0%=1Mb, Max Block#: 2513

 

존넘님이 2005-09-29 18:16에 작성한 댓글입니다. Edit

잘 모르는 ASE에 ASIQ 를 붙여서 이상한 질문(?)이나 하고..ㅡㅡ;

 

정말이지 사이베이스 데이터베이스 관리를 하기위해서는

 

어떤 것들을 차곡차곡 순서있게 지식을 쌓아야만 할까요?

 

메뉴얼에 있는 내용은 너무나 방대해서 그리고 영어도 짧고....ㅡㅡ;

 

ASIQ 에 관련된 족보같은게 있으면...좋을련만 아니면,

 

콕콕찝어서 이것은 꼭 보라~ 하는 정보라도 있었으면 합니다.

 

 

염치없게 또 부탁을 드립니다. 내용이 많으면 저의 메일이라도...luceifer@freechal.com 입니다.

 

 

참.. 저장공간 확인은 엄청 간단해서 좋은거 같습니다.

세부정보는 다른 sp 를 돌려야 겠지만..

 

감사합니다.

 

 

홍님이 2005-09-30 10:16에 작성한 댓글입니다. Edit
[Top]
No.
제목
작성자
작성일
조회
1308linux c 환경에서 sybase를 이용한 프로그램 개발 [2]
개발자
2005-09-29
2971
1307경고 메세지가 뜨는데 어떻게 해야하는지 알려주세요 [1]
싸이
2005-09-29
2897
1306세션을 kill 할려고 하면 어떻게 해야 아나요? [1]
초보
2005-09-29
3386
1305ASIQ 에서 dbspace 의 segment 사용량 확인 방법은?? [2]
2005-09-28
5166
1304BCP Error [1]
초보자
2005-09-28
3117
1303sybase-12.5 linux버전 받아서 설치하는 방법좀 알려주세요 [2]
싸이설치
2005-09-27
3280
1301쿼리문 질문입니다 [2]
왕초보
2005-09-27
4229
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.017초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다