Sql_Trace File Identifier 我们设置了sql_trace为true之后,trace file会dump到udump中,但是该目录下也许已经有很多trace file了,或者其他session也设置了sql_trace为true,也在产生trace file。如何能迅速找到你的session产生的trace file呢?我们可以通过如下语句设置Sql_Trace File Identifier:
这样你的session产生的trace file就会以设置的identifier为后缀。
然后我们可以看到udump下生成的trace file文件名为:test_ora_4168_test_identifier.trc Sample Block 抽样表扫描(sample table scan)只读取一个表的部分数据。其实我们只选择表的部分数据的话,可以用rownum来限制也很方便。但是考虑如下情况: A表和B表join,我只想A表的部分数据去连接B表,此时用sample就方便的多。如果用rownum就需要用一个subquery。
抽样表扫描有两种形式,一种是抽样表中行数的一个百分比,一个是抽样表中块数的一个百分比。注意都是百分比。语法如下:
也可以在视图上使用SAMPLE。
今天google分析函数row_number()的时候发现的,觉得很好: 表demo是重复拷贝自dba_objects,有88万左右,不重复的是27323,没有索引 方法一:delete from demo a where a.rowid <> (select max(rowid) from demo b where b.object_id=a.object_id); 耗时:几个小时以上 方法二: delete from demo where rowid in (select rid from (select rowid rid,row_number() over(partition by object_id order by rowid) rn from demo) where rn <> 1 ); 耗时:30秒 方法三: create table demo2 as select object_id,owner... from (select demo.*,row_number() over(partition by object_id order by rowid) rn from demo) where rn = 1; truncate table demo; insert into demo select * from demo2; drop table demo2; 共耗时: 10秒,适合大数据量的情况,产生更少回滚量; 学到了分析函数row_number(),对于object_id和rowid也有了一些认识。oracle要学的东西太多了,什么时候是个头啊。上面的方法不是很难理解,但也还没有完全理解,有机会实际试试。
Orchadmin is a command line utility provided by datastage to research on data sets.The general callable format is : $orchadmin [options] [descriptor file]1. Before using orchadmin, you should make sure that either the working directory or the $APT_ORCHHOME/etc contains the file “config.apt” ORThe environment variable $APT_CONFIG_FILE should be defined for your session.Orchadmin commandsThe various commands available with orchadmin are1. CHECK: $orchadmin checkValidates the configuration file contents like , accesibility of all nodes defined in the configuration file, scratch disk definitions and accesibility of all the nodes etc. Throws an error when config file is not found or not defined properly2. COPY : $orchadmin copyMakes a complete copy of the datasets of source with new destination descriptor file name. Please not thata. You cannot use UNIX cp command as it justs copies the config file to a new name. The data is not copied.b. The new datasets will be arranged in the form of the config file that is in use but not according to the old confing file that was in use with the source.3. DELETE : $orchadmin <> [-f -x] descriptorfiles….The unix rm utility cannot be used to delete the datasets. The orchadmin delete or rm command should be used to delete one or more persistent data sets.-f options makes a force delete. If some nodes are not accesible then -f forces to delete the dataset partitions from accessible nodes and leave the other partitions in inaccesible nodes as orphans.-x forces to use the current config file to be used while deleting than the one stored in data set.4. DESCRIBE: $orchadmin describe [options] descriptorfile.dsThis is the single most important command.1. Without any option lists the no.of.partitions, no.of.segments, valid segments, and preserve partitioning flag details of the persistent dataset.-c : Print the configuration file that is written in the dataset if any-p: Lists down the partition level information.-f: Lists down the file level information in each partition-e: List down the segment level information .-s: List down the meta-data schema of the information.-v: Lists all segemnts , valid or otherwise-l : Long listing. Equivalent to -f -p -s -v -e5. DUMP: $orchadmin dump [options] descriptorfile.dsThe dump command is used to dump(extract) the records from the dataset.Without any options the dump command lists down all the records starting from first record from first partition till last record in last partition.-delim ‘’ : Uses the given string as delimtor for fields instead of space.-field : Lists only the given field instead of all fields.-name : List all the values preceded by field name and a colon-n numrecs : List only the given number of records per partition.-p period(N) : Lists every Nth record from each partition starting from first record.-skip N: Skip the first N records from each partition.-x : Use the current system configuration file rather than the one stored in dataset.6. TRUNCATE: $orchadmin truncate [options] descriptorfile.dsWithout options deletes all the data(ie Segments) from the dataset.-f: Uses force truncate. Truncate accessible segments and leave the inaccesible ones.-x: Uses current system config file rather than the default one stored in the dataset.-n N: Leaves the first N segments in each partition and truncates the remaining.7. HELP: $orchadmin -help OR $orchadmin -helpHelp manual about the usage of orchadmin or orchadmin commands
当一个Job跑到一半终止了要还原,在DS Director中主要有三种方法来还原:1 Job-----Reset2 Job-----Clear Status File3 Job-----Cleanup Resource具体细节也不懂,有时间慢慢研究