使用informatica计算同期往期值

    在数据仓库往小集市的时候,经常要计算某一个指标的同期往期值,这个确实是不太好做.做同期往期确实让人头痛.
    在多维数据库essbase中计算同期往期是非常方便.写一个计算脚本即可,essbase以一种类似指针的方式计算同期往期值,要在oracle中用sql出计算同期往期的语句也不是不可能.但是比较麻烦.倘若放在前端brio中计算那更是麻烦.开始的时候是在informatica中以lookup的方式取出某一个指标的同期往期值,事实上这个可以实现.也经过考验,但是有个缺点就是速度较慢.无数次的lookup在数据量上千万行的表中速度慢到每秒仅能处理10行数据,前几天在做几个大表.从4个表中取出数据做计算.每个表中都有四五千万行的数据,再使用lookup方式我都不敢想像性能会低到什么程度,突然有个想法,逆向来做,某年某月的指标值其实就是下个月的往期值,下年的同期值,在etl过程中写数据的时候把目标表复制3份,直接就把数据给存储到相应的时间.这样一条数据会以3个不同的时间存往3个相应的同期,往期,当期字段.经过这样改造,同期往期计算在etl中简单完成.对于千万级的表处理可达到几千条数据每秒的输出速度.基本能满足项目需要.

使用存储过程创建同义词

在给数据库建同义词的时候原来表比较少的时候还手工建.试着写个存储过程结果里面不让执行DDL语句,郁闷ing.还好找到一个变通的方法,使用execute immediate方法.

create or replace procedure xmds.xmds_set_sy(
ownername IN varchar2
) is
table_name varchar2(50):=”;
sqltext varchar2(100):=”;
  cursor cur_tablename is
    select TABLE_NAME from ALL_TABLES where owner=ownername;
begin
  open cur_tablename;
  loop
    fetch cur_tablename into table_name;
    exit when cur_tablename%notfound;
  sqltext:=’create or replace public synonym ‘||table_name||’ for ‘||ownername||’.’||table_name;
  dbms_output.put_line(sqltext) ;
  execute immediate sqltext;
  commit;
  end loop;
  close cur_tablename;  
end xmds_set_sy;

国庆啦

恩.国庆啦.放假了.
刚出来工作,肯定是很苦,苦我倒是不怕,但我是希望苦后是有甜的.
来了这么几个月,大家对我工作能力的信任我很感谢,我也希望我能担任起技术带头人这么一个角色,
当然就目前来说我还欠缺很多,工作经验是一部份,恩.小廖说的对.其实一个工作上的思路是非常重要的.而且HC也说的很好.恩.有时候我的确是更需要显得有魄力一点.
接下来的几个月将是我负责ETL这个部分,10月份和小魏做第二阶段的设计工作,恩.工作很近,任务也很重,加油.dean.你会做的更好的.

这个斑马线我该怎么过?

厦门这斑马线是越来越看不懂了.在建兴路与湖滨北路的交口,原来横跨路口的斑马线给改成这样了.
大家看看这人行道我该怎么走?

走到马路中间以后……
[img][attach]1[/attach][/img]
发于小鱼论坛
http://www.xmfish.com/thread-975041-1-1.html

ORA-03297: 文件包含在请求的 RESIZE 值以外使用的数据

如题:在truncate table后,着手resize(小) tablesapce,报以上信息。

Metalink:(因为表的高水平标志没有被释放)

fact: Oracle Server – Enterprise Edition
symptom: Resizing a tablespace returns error
symptom: ORA-03297: file contains %s blocks of data beyond requested RESIZE
value
cause: There are extents allocated in the datafile beyond the size the user
wanted to resize the file to.

fix:

Use the following SELECT to find the extents (and their segments-objects) that
are placed beyond the desired size in the tablespace’s file:

SELECT owner, segment_name, segment_type, tablespace_name, file_id,
((block_id+1)*(SELECT value FROM v$parameter
WHERE UPPER(name)=’DB_BLOCK_SIZE’)+BYTES) end_of_extent_is_at_this_byte
FROM dba_extents
WHERE ((block_id+1)*(SELECT value FROM v$parameter
WHERE UPPER(name)=’DB_BLOCK_SIZE’)+BYTES) > (*1024*
1024)
AND tablespace_name=’
ORDER BY file_id, end_of_extent_is_at_this_byte;

Just substitute the and for
their actual values.

To receive only the objects that have extents beyond the size in question, use
the following query:

SELECT DISTINCT owner, segment_name, segment_type, tablespace_name, file_id
FROM dba_extents
WHERE ((block_id+1)*(SELECT value FROM v$parameter
WHERE UPPER(name)=’DB_BLOCK_SIZE’)+BYTES) > (*1024*
1024)
AND tablespace_name=’
ORDER BY file_id, owner, segment_name, segment_type;

You will be able to resize the file to the desired size if this SELECT returns
0 rows.
So you have to drop the selected segments (tables or indexes) to be able to
resize the datafile. Before dropping the objects you can export them or move
them to another tablespace.