key words:数据库 主键
在一个差屁股的项目中看到数据库的设计着实让人窝火,业务也算有点复杂,但是关键的表其实也就不超过10来个,但是能把你整晕,让人不得不佩服当初数据库设计的人员的构思. 总体来看存在问题就是主键命名不当,外键的命名也不规范,在和项目组人员的沟通过程中我就强烈暗示大家以后的项目中主键不要想花里胡哨的名字了,直接全部一刀切”ID”就OK了(要是非要找一个理由,不妨看看rails的最佳实践做法),直观明了,外键的名字用父表的表名_id .
另外,我的一位同事提到给表的前面加上业务前缀,或者叫模块前缀,也有实际意义,主要是在项目相对比较复杂,模块比较多的时候比较有用,比如 businessa_table,businessb_table,可能也会看起来麻烦一些,看情况了。
1.机器的ip经常改变,到公司一个ip,到客户那一个ip,到家又是一个ip,不知怎么搞的,今天到家oracle的dbconsole就启动不了了.
2.用命令行的方式启动 emctl.bat start dbconsole,结果还提示ORACLE_SID 还没有设置,晕,这个怎么没有了,set 一个吧 set ORACLE_SID=dggmcc (我的数据库实例)
3.还是有错,提示找不到192.168.0.52.这个地址,应该是ip和当初装数据库的时候IP不一样的缘故,将hosts设置一下 192.168.0.52 IDEA
4.OK
|
| 协同软件 | ||
| 协同软件(Collaboration Software )是一种“互相配合”的软件,主要作用是为了辅助多人、多组织共同完成管理事务,协同参与者是多个人员与群组和多个应用系统。工作流管理WFM是协同软件 的主要功能核心,协同软件在文档、行政、人事、项目、客户、财务、物流、生产等管理方面有广泛应用,协同OA、协同政务、协同商务是其主要综合应用方案。>>全文 | ||
|
||
|
||
|
| 协同软件厂商 | ||
| 协同软件兴起于三四年前,之后便快速发展,到现在市场上号称做协同的软件厂商已经超过500家。整个协同市场因为用户需求的增加而使得各相关厂商蜂拥而至——原来做OA的、做ERP的、做互联网的厂商都开始了在协同这个大平原上竞争和角力。 正因为协同厂商发力点的不同,使得用户协同的切入点不同—从OA起步会有更广阔的办公自动化空间,从业务出身能将生产、采购、营销的步调一致,互联网则预示着电子商务有望初具规模。 无论用户的选择是什么,企业管理和业务的协同,才是殊途同归。 | ||
|
| IBM Lotus | ||
| 在25年的时间里,Lotus定义了一个实现人员互连的软件行业。所有Lotus产品之间、与基于开放标准的软件之间以及与Microsoft产品之间都可很好地协同使用。它们可用于多种客户端和服务器操作系统。 Lotus产品始终致力于推动创新与合作。IBM的协作产品,包括Lotus Notes、WebSphere Portal Lotus Sametime以及新产品Lotus Quickr和 Lotus Connections可配套使用,提供业务流程环境中的协作。 IBM Lotus继续提供业界最丰富的企业通信和协作工具系列,并通过将协作技术扩展到社会计算等新领域,推动该系列的进一步发展。IBM Lotus的协作服务旨在具备灵活性,包括可在多种环境中组合使用的通信、协作和沟通工具。从电子邮件/日历环境到门户、实时协作和移动服务, IBM Lotus协作服务涵盖多个层面和视角,为广泛的最终用户工作方式提供服务,最大限度提高最终用户的效率。 |
||
|
1.oracle structure:db - > AS - > apps
2.start infrastructure
#su - oracle
. oraenv
[sid] : ocsdb
ocsctl_sample –start infra
2. start apps
# su - oracle
# export ORACLE_HOME=/home/oracle/ocs/apps
# $ORACLE_HOME/bin/ocsctl_sample –start apps
(here you can set var to your .bash profile)
| ./opmnctl startproc gid=OC4J_Portal |
| ./opmnctl startproc gid=OC4J_Portal |
3. start single component
# ./opmnctl startproc gid=OC4J_Portal
4.the RTC components:
5.the portal components:
note difference with iLearning:
1.db startup
sql>startup
2.start app
opmnctl startall
3.web console
emctl start iasconsole
(emctl start dbconsole command to start oracle db console)
oc4j and deployment
dcmctl createcomponent -ct oc4j -co 【oc4j_name】
dcmctl deployapplication -co 【oc4j_name】 -f webs.war -a 【app_name】 -rc /【rc_name】
可以用命令的方式来备份,先全量备份,后增量备份,这个是专业的方式,还有一种方式我称它为土八路的方式,但是好使
就是直接把oradata目录的文件拷贝出来即可,下次重新安装oracle后 把oradata目录覆盖即可。
当然,如果你愿意,也可以把所有oracle的目录拷贝下来
简单就好 ![]()
key words: invalid file operation,utl_file_dir
how to set utl_file_dir in oracle?
my db is Oracle10g,and the default boot method is spfile
1. sql> alter system set utl_file_dir=’c:\tmp’ scope=spfile
2.sql>shutdown immediate
3.sql>start
This time I change the mydbspfile.ora directly,but made mistake,late resolved it by
“create spfile from pfile”
reference here
key words: decode,分组
使用 decode可以实现将多个不同的行级别的记录转换到列,有时很有用
come from here
表、视图结构转化
现有一个商品销售表sale,表结构为:
month char(6) –月份
sell number(10,2) –月销售金额
现有数据为:
200001 1000
200002 1100
200003 1200
200004 1300
200005 1400
200006 1500
200007 1600
200101 1100
200202 1200
200301 1300
想要转化为以下结构的数据:
year char(4) –年份
month1 number(10,2) –1月销售金额
month2 number(10,2) –2月销售金额
month3 number(10,2) –3月销售金额
month4 number(10,2) –4月销售金额
month5 number(10,2) –5月销售金额
month6 number(10,2) –6月销售金额
month7 number(10,2) –7月销售金额
month8 number(10,2) –8月销售金额
month9 number(10,2) –9月销售金额
month10 number(10,2) –10月销售金额
month11 number(10,2) –11月销售金额
month12 number(10,2) –12月销售金额
结构转化的sql语句为:
create or replace view
v_sale(year,month1,month2,month3,month4,month5,month6,month7,month8,month9,month10,month11,month12)
as
select
substrb(month,1,4),
sum(decode(substrb(month,5,2),01,sell,0)),
sum(decode(substrb(month,5,2),02,sell,0)),
sum(decode(substrb(month,5,2),03,sell,0)),
sum(decode(substrb(month,5,2),04,sell,0)),
sum(decode(substrb(month,5,2),05,sell,0)),
sum(decode(substrb(month,5,2),06,sell,0)),
sum(decode(substrb(month,5,2),07,sell,0)),
sum(decode(substrb(month,5,2),08,sell,0)),
sum(decode(substrb(month,5,2),09,sell,0)),
sum(decode(substrb(month,5,2),10,sell,0)),
sum(decode(substrb(month,5,2),11,sell,0)),
sum(decode(substrb(month,5,2),12,sell,0))
from sale
group by substrb(month,1,4);
key words: update,ORA-01779
经常用到update语句,不过很少用到其他表的数据来更新当前表,这次用到了,总结一下
UPDATE
( SELECT /*+ BYPASS_UJVC */
a.groupname a1,b.groupname b1 from t_account_temp a,t_certificode_temp b
where a.certificode = b.certificode
)
SET a1=b1;
特别的地方是要加 /*+ BYPASS_UJVC */,让oracle不检查健的约束,否则会报ORA-01779错误,不过前提是你确认确实不会有多个b表的值出现,或者即使有多个值也没有影响。
相关参考如下
key words: plsql,导出数据,大数据量
最近的账务的项目中需要导出Excel报表,数据量比较大,解决方案如下 :
1.通过plsql在服务器端查询出符合要求的纪录,然后直接写到文本文件中
2.在web端通过流的方式读文本文件,通过POI写到Excel,将生成的Excel流写到respoonse实现下载
这样做的好处是不必一次性将满足条件的纪录全部取出来,而是通过流的方式.
这个方式原来在处理Blob类型的字段时有直接的getStream来支持的,这次普通的数据只好通过文件的方式来实现.
贴一段sample的代码
create or replace procedure alex_table_to_txt(filepath varchar2,filename varchar2) is
--var
v1 alex2.name%type;
v2 alex2.address%type;
v3 alex2.groupname%type;
output varchar2(200);
–file var
file_handle UTL_FILE.FILE_TYPE;
cursor readtable is select t.name,t.address,t.groupname from alex2 t;
begin
file_handle:=utl_file.fopen(filepath,filename,’w',6000);
open readtable;
loop
fetch readtable into v1,v2,v3;
exit when readtable%notfound;
output:=v1 || ‘,’ || v2 || ‘,’ || v3 ;
utl_file.put_line(file_handle,output);
end loop;
close readtable;
utl_file.fclose(file_handle);
end alex_table_to_txt;
/
欢迎讨论你的方案