全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 SAS专版
7495 9
2010-01-04
有一个大表,曾经建过索引,现在索引坏了,无论做什么操作sas都要先为它重建索引,delete index的话也要先重建再删,但是目前的硬盘空间不足以重建索引,所以就会死在那里。

请问有没有办法不重建索引就能让sas把这个表恢复为无索引表?

注:表80G,建索引的临时空间要300G左右
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2010-1-4 10:54:22
arnoldsw 发表于 2010-1-4 10:06
有一个大表,曾经建过索引,现在索引坏了,无论做什么操作sas都要先为它重建索引,delete index的话也要先重建再删,但是目前的硬盘空间不足以重建索引,所以就会死在那里。

请问有没有办法不重建索引就能让sas把这个表恢复为无索引表?

注:表80G,建索引的临时空间要300G左右
You can use the rebuilt statement with noindex options in SAS unitility procedure "proc datasets" to rebuilt the data set.

Here is example with log files.

HTH
********************************

libname s 'c:\downloads';
data s.t2(index=(x) );
   do i=1 to 100;
     x=ceil(ranuni(12345)*5);
     output;
   end;
run;
proc datasets lib=s ;
quit;

option noxwait;
****delete the index with host command**;
data _null_;
cmd=  'del c:\downloads\t2.sas7bndx' ;
call  system(cmd);
run;

proc datasets lib=s ;
rebuild t2 /noindex;
quit;

proc datasets lib=s ;
quit;

*************************log**********************;

1466  libname s 'c:\downloads';
NOTE: Libref S was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\downloads
1467  data s.t2(index=(x) );
1468     do i=1 to 100;
1469       x=ceil(ranuni(12345)*5);
1470       output;
1471     end;
1472  run;

NOTE: The data set S.T2 has 100 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1473  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
                         T2       INDEX      9216  03Jan10:21:49:39
1474  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1475
1476  option noxwait;
1477  ****delete the index with host command**;
1478  data _null_;
1479  cmd=  'del c:\downloads\t2.sas7bndx' ;
1480  call  system(cmd);
1481  run;

NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.15 seconds


1482
1483  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1484  rebuild t2 /noindex;
1485  quit;

NOTE: Rebuilding S.T2 (memtype=DATA).
NOTE: File S.T2.INDEX does not exist.
NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


1486
1487  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1488  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-1-4 11:59:52
为啥我这里sas9.1没找到rebuild相关的东西?
proc datasets下面rebuild是红色字,帮助里面也没找到
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-1-4 16:07:35
有没有人知道哇
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-1-4 16:27:41
bobguy 发表于 2010-1-4 10:54
arnoldsw 发表于 2010-1-4 10:06
有一个大表,曾经建过索引,现在索引坏了,无论做什么操作sas都要先为它重建索引,delete index的话也要先重建再删,但是目前的硬盘空间不足以重建索引,所以就会死在那里。

请问有没有办法不重建索引就能让sas把这个表恢复为无索引表?

注:表80G,建索引的临时空间要300G左右
You can use the rebuilt statement with noindex options in SAS unitility procedure "proc datasets" to rebuilt the data set.

Here is example with log files.

HTH
********************************

libname s 'c:\downloads';
data s.t2(index=(x) );
   do i=1 to 100;
     x=ceil(ranuni(12345)*5);
     output;
   end;
run;
proc datasets lib=s ;
quit;

option noxwait;
****delete the index with host command**;
data _null_;
cmd=  'del c:\downloads\t2.sas7bndx' ;
call  system(cmd);
run;

proc datasets lib=s ;
rebuild t2 /noindex;
quit;

proc datasets lib=s ;
quit;

*************************log**********************;

1466  libname s 'c:\downloads';
NOTE: Libref S was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\downloads
1467  data s.t2(index=(x) );
1468     do i=1 to 100;
1469       x=ceil(ranuni(12345)*5);
1470       output;
1471     end;
1472  run;

NOTE: The data set S.T2 has 100 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1473  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
                         T2       INDEX      9216  03Jan10:21:49:39
1474  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds


1475
1476  option noxwait;
1477  ****delete the index with host command**;
1478  data _null_;
1479  cmd=  'del c:\downloads\t2.sas7bndx' ;
1480  call  system(cmd);
1481  run;

NOTE: DATA statement used (Total process time):
      real time           0.20 seconds
      cpu time            0.15 seconds


1482
1483  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1484  rebuild t2 /noindex;
1485  quit;

NOTE: Rebuilding S.T2 (memtype=DATA).
NOTE: File S.T2.INDEX does not exist.
NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.03 seconds


1486
1487  proc datasets lib=s ;
                                             Directory

                                    Libref         S
                                    Engine         V9
                                    Physical Name  c:\downloads
                                    Filename       c:\downloads


                                  Member     File
                      #  Name     Type       Size  Last Modified

                      1  SASMACR  CATALOG   25600  24Dec09:23:08:56
                      2  T2       DATA       9216  03Jan10:21:49:39
1488  quit;

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           0.03 seconds
      cpu time            0.01 seconds
学习了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2010-1-4 16:53:23
2楼好像用的是SAS 9.2,在SAS 9.1中,proc datasets里面有REPAIR语句可以修复索引

SAS HELP
The most common situations that require the REPAIR statement are as follows:
   2、The device on which a SAS data set or an associated index resides is damaged. In this case, you can restore the damaged data set or index from a backup device, but the data set and index no longer match.

可以把
proc datasets lib=s ;
rebuild t2 /noindex;
quit;
改为
proc datasets lib=s ;
repair t2;
quit;
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群