-
Feb07
禁用/启用所有外键约束
Posted in Database, 12 views
-
1、ORACLE数据库中的外键约束名都在表user_constraints中可以查到。其中constraint_type='R'表示是外键约束。
2、启用外键约束的命令为:alter table table_name enable constraint constraint_name
3、禁用外键约束的命令为:alter table table_name disable constraint constraint_name
4、然后再用SQL查出数据库中所以外键的约束名:
select 'alter table '||table_name||' enable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
select 'alter table '||table_name||' disable constraint '||constraint_name||';' from user_constraints where constraint_type='R'
-
No Comments » fk oracle 启用 外键 禁用 约束
-
Feb03
用SQL处理多行汇聚问题
Posted in Database, Program, 17 views
-
表结构如下:
NAME Null Type
------------------------ --------- -----
N_SEC_CODE NOT NULL CHAR(6)
C_RESEARCHER_CODE NOT NULL VARCHAR2(20)此表保存了“股票”与“研究员”的对应关系数据,一般而言,对于同一只股票而言,可能有多个研究员对其进行跟踪研究。所以目前遇到一个要求,需查询出每只股票和对应的研究员(研究员代码间,使用逗号分隔)。
例如有如下数据:
000297 chenpeng
000297 liusu
合并处理后需显示为:
000297 chenpeng,liusu多行数据汇总聚一行,只需要把SQL中“n_sec_code”换为你的用来汇总的列,“c_researcher_code”替换为需合并文本的列,“m_researcher_stock_rel”替换为你的表名
SELECT n_sec_code,
TRANSLATE (LTRIM (text, '/'), '*/', '*,') researcherList
FROM
(SELECT ROW_NUMBER () OVER (PARTITION BY n_sec_code ORDER BY n_sec_code, lvl DESC) rn,
n_sec_code ,
text
FROM
(SELECT n_sec_code,
LEVEL lvl ,
SYS_CONNECT_BY_PATH (c_researcher_code,'/') text
FROM
(SELECT n_sec_code ,
c_researcher_code AS c_researcher_code,
ROW_NUMBER () OVER (PARTITION BY n_sec_code ORDER BY n_sec_code,c_researcher_code) x
FROM m_researcher_stock_rel
ORDER BY n_sec_code,
c_researcher_code
) a CONNECT BY n_sec_code = PRIOR n_sec_code
AND x - 1 = PRIOR x
)
)
WHERE rn = 1
ORDER BY n_sec_code; -
No Comments » SQL 多行 汇聚
-
Jan25
友好的SecureCRT日志文件设置
Posted in Linux, 50 views
-
SecureCRT可以完整记录下所有信息,但是默认的日志文件设置并不好用。
这里给出我的日志文件配置,遵循以下原则:
1、通过浏览文件名可以获得该日志内容的主要信息
2、文件名唯一
3、每个session的日志独立由此将Logfilename配置为:%H_%Y%M%D_%h%m_%s%t.log
其中:
%H-主机名或主机IP地址
%Y-四位年份
%M-2位月份
%D-2位日期
%h-2位小时数
%m-2位分钟数
%s-2位秒数
%t-2位毫秒数最后,在logfile的option中,选中“Start log upon connect” 和 “Append to file”。
自此,所有在SecureCRT中显示过的信息都会如实记录在日志文件中。
-
No Comments » log secureCRT ssh 日志
-
Jan25
可怕的感性与可怕的理性
Posted in View, 71 views
-
本文转载自思华商业模式
前段时间有一则“分贝网CEO因办裸聊网站被捕”的消息,这并不奇怪,“黄,赌,毒”任何时候都是一个足以使人疯狂的诱惑,尤其在正规通道越来越难以为继,越来越需要“心智体美劳”全面发展的时候。
在任何一个全分类浏览文章的网站中,阅读排名靠前的肯定是关乎“性”,“暴乱”,“愤青”等之类的文章,这是人们潜在的超级感性的一面;
探究任何一个存续时间很长的大公司背后,并不是因为他们一直在提供超级感性的东西,而是因为他们一直在努力为顾客提供“超级理性”的东西。
这样,我们将一个事物从诞生到成长过程中,人们感性与理性的变化趋势与效率之间的关系绘制如图:
商业世界的效率在最初都是发迹于感性,当最初的感性退却,进入平淡期,而后是理性的方面。这个模型可以解释很多现象:
比如,呼啦圈的全民热----进入平淡期---只有少数坚持锻炼的人还在呼啦圈;
比如博客的兴起,全民皆博-----渐渐的进入平淡期,更多的人转向更容易的微博-----只有很少的人还在坚持的人写博客;
比如现在很火的微博-----慢慢的只要有最新的,更容易的事物出现,他也会衰退-----剩下一些微博的铁杆粉丝。
比如现在很火的阿凡达-----慢慢最初的热情退却-----只剩下一些超级理性的忠实粉丝。
这给创业者的启示是什么?
- 如果你的创业起于满足人们一个简单的感性方面的诉求,那么相对容易的多;
- 必须坚持持续的理性引导用户,因为感性的那部分最终是会“离你而去”;
- 明白这个变化规律,做好及时应变。
Blogged with the Flock Browser -
No Comments » 创业 商业模式 思想
-
Jan22
PowerCmd v2.1 Serial Numbers
Posted in Something, 54 views
-
Name: Flynn1982
S/N:
PCMDA-TU3YB-3TBUY-CADPM
PCMDA-O86AF-6OF8A-CADPM
PCMDA-E56IC-6EC5I-CADPM
PCMDA-MFUU2-UM2FU-CADPM
PCMDA-MQG03-GM3Q0-CADPM
ÐCMDA-J5NBD-NJD5B-CADPM
PCMDA-KTDCK-DKKTC-CADPM
PCMDA-EBHNE-HEEBN-CADPM
PCMDA-N461Y-6NY41-CADPM
PCMDA-5LPZY-P5YLZ-CADPM -
No Comments » powercmd sn
-
Jan16
Mysql中的STRICT_TRANS_TABLES
Posted in Database, Program, 90 views
-
在调试php symfony,加载fixture数据时,遇到了错误:
SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'log' for column 'tasklog_id' at row 1
这是因为mysql5.5中默认启用了STRICT_TRANS_TABLES参数。
STRICT_TRANS_TABLES的工作方式:
· 对于事务性存储引擎,在语句中任何地方出现的不良数据值均会导致放弃语句并执行回滚。
· 对于非事务性存储引擎,如果错误出现在要插入或更新的第1行,将放弃语句。(在这种情况下,可以认为语句未改变表,就像事务表一样)。首行后出现的错误不会导致放弃语句。取而代之的是,将调整不良数据值,并给出告警,而不是错误。换句话讲,使用STRICT_TRANS_TABLES后,错误值会导致MySQL执行回滚操作,如果可以,所有更新到此为止。要想执行更严格的检查,请启用STRICT_ALL_TABLES。除了非事务性存储引擎,它与STRICT_TRANS_TABLES等同,即使当不良数据出现在首行后的其他行,所产生的错误也会导致放弃语句。这意味着,如果错误出现在非事务性表多行插入或更新过程的中途,仅更新部分结果。前面的行将完成插入或更新,但错误出现点后面的行则不然。
因此,解决方法就是在my.ini里把STRICT_TRANS_TABLES关掉
#Set the SQL mode to strict #sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
-
No Comments » my.ini mysql php STRICT_TRANS_TABLES symfony
-
Jan04
Enterprise Architect 7 资源
Posted in Database, Program, 133 views
-
Enterprise Architect 7.5 汉化版下载:
http://9.gddx3.crsky.com:808/200907/ha_EnterpriseArchitect-v7.5.843fix.zipEnterprise Architect 7.5注册码
Name:whitehouse.net.cn
Company:eric
注册码:{67SC0O95-SZPS-LIG2-YQ8Q-8D2N-KWTD-0W6R-TWDD-KT6RB-1J}Enterprise Architect 7.1注册码
Name:whitehouse.net.cn
Company:whitehouse.net.cn
注册码:{GLAOMULN-N1F1-EGBC-XN52-9QC6-GJGJ-0W6R-TWDD-KT6RB-SQ} -
3 Comments » ea Enterprise Architect 汉化 注册
-
Dec25
-
Congratulations! The transfer request for the following domain name(s) has been completed:
DBALIFE.COM
域名转移终于完成了,由edong.com转移到godaddy.com,彻底摆脱通信管理局的控制。
下一步再把万网的域名转移过来。
政府宣传了几千年大禹治水,现在依然只会一刀切,只会干这种万人唾骂的事,谁还记得疏优于堵?
堵吧,不知道最后哭的人是谁。
-
No Comments »
-
Nov23
Chrome Frame导致IE异常
Posted in Something, 88 views
-
访问Google Wave时,被要求安装Chrome Frame插件。
几天后发现IE出现了非常奇怪的问题,google reader的列表全部无法在新窗口打开,页面空白,标题类似:cf:attach_external_tab&71619392&3
这意味着用户只能看google reader里的摘要,而看不到全文
郁闷了好几天,终于发现是Chrome Frame(cf)的问题,将其禁用后,一些正常。
-
No Comments » chrome frame Google ie wave
-
Nov16
Oracle Trace Level Event Numbers
Posted in Database, 141 views
-
Oracle Trace Level Event Numbers
相关参考信息:
10000 control file debug event, name 'control_file' 10001 control file crash event1 10002 control file crash event2 10003 control file crash event3 10004 control file crash event4 10005 trace latch operations for debugging 10006 testing - block recovery forced 10007 log switch debug crash after new log select, thread %s 10008 log switch debug crash after new log header write, thread %s 10009 log switch debug crash after old log header write, thread %s 10010 Begin Transaction 10011 End Transaction 10012 Abort Transaction 10013 Instance Recovery 10014 Roll Back to Save Point 10015 Undo Segment Recovery 10016 Undo Segment extend 10017 Undo Segment Wrap 10018 Data Segment Create 10019 Data Segment Recovery 10020 partial link restored to linked list (KSG) 10021 latch cleanup for state objects (KSS) 10022 trace ktsgsp 10023 Create Save Undo Segment 10024 Write to Save Undo 10025 Extend Save Undo Segment 10026 Apply Save Undo 10027 latch cleanup for enqueue locks (KSQ) 10028 latch cleanup for enqueue resources (KSQ) 10029 session logon (KSU) 10030 session logoff (KSU) 10031 row source debug event (R*) 10032 sort end (SOR*) 10035 parse SQL statement (OPIPRS) 10036 create remote row source (QKANET) 10037 allocate remote row source (QKARWS) 10038 dump row source tree (QBADRV) 10039 type checking (OPITCA) 10040 dirty cache list 10041 dump undo records skipped 10042 trap error during undo application 10044 free list undo operations 10045 "free list update operations - ktsrsp, ktsunl" 10046 enable SQL statement timing 10047 trace switching of sessions 10048 Undo segment shrink 10049 protect library cache memory heaps 10050 sniper trace 10051 trace OPI calls 10052 don't clean up obj$ 10053 CBO Enable optimizer trace 10054 trace UNDO handling in MLS 10055 trace UNDO handing 10056 dump analyze stats (kdg) 10057 suppress file names in error messages 10058 use table scan cost in tab$.spare1 10060 CBO Enable predicate dump 10061 disable SMON from cleaning temp segment 10062 disable usage of OS Roles in osds 10063 disable usage of DBA and OPER privileges in osds 10064 "thread enable debug crash level %s, thread %s" 10065 limit library cache dump information for state object dump 10066 simulate failure to verify file 10067 force redo log checksum errors - block number 10068 force redo log checksum errors - file number 10069 Trusted Oracle test event 10070 force datafile checksum errors - block number 10071 force datafile checksum errors - file number 10072 protect latch recovery memory 10073 have PMON dump info before latch cleanup 10074 default trace function mask for kst 10075 CBO Disable outer-join to regular join conversion 10076 CBO Enable cartesian product join costing 10077 CBO Disable view-merging optimization for outer-joins 10078 CBO Disable constant predicate elimination optimization 10080 dump a block on a segment list which cannot be exchanged 10081 segment High Water Mark has been advanced 10082 free list head block is the same as the last block 10083 a brand new block has been requested from space management 10084 free list becomes empty 10085 free lists have been merged 10086 CBO Enable error if kko and qka disagree on oby sort 10087 disable repair of media corrupt data blocks 10088 CBO Disable new NOT IN optimization 10089 CBO Disable index sorting 10090 invoke other events before crash recovery 10091 CBO Disable constant predicate merging 10092 CBO Disable hash join 10093 CBO Enable force hash joins 10094 before resizing a data file 10095 dump debugger commands to trace file 10096 after the cross instance call when resizing a data file 10097 after generating redo when resizing a data file 10098 after the OS has increased the size of a data file 10099 after updating the file header with the new file size 10100 after the OS has decreased the size of a data file 10101 atomic redo write recovery 10102 switch off anti-joins 10103 CBO Disable hash join swapping 10104 dump hash join statistics to trace file 10105 CBO Enable constant pred trans and MPs w WHERE-clause 10106 CBO Disable evaluating correlation pred last for NOT IN 10107 CBO Always use bitmap index 10108 CBO Don't use bitmap index 10109 CBO Disable move of negated predicates 10110 CBO Try index rowid range scans 10111 Bitmap index creation switch 10112 Bitmap index creation switch 10113 Bitmap index creation switch 10114 Bitmap index creation switch 10115 CBO Bitmap optimization use maximal expression 10116 CBO Bitmap optimization switch 10117 CBO Disable new parallel cost model 10118 CBO Enable hash join costing 10119 QKA Disable GBY sort elimination 10120 CBO Disable index fast full scan 10121 CBO Don't sort bitmap chains 10122 CBO disable count(col) => count(*) transformation 10123 QKA Disable Bitmap And-EQuals 10145 test auditing network errors 10146 enable Oracle TRACE collection 10200 block cleanout 10201 consistent read undo application 10202 consistent read block header 10203 consistent read buffer status 10204 signal recursive extend 10205 row cache debugging 10206 transaction table consistent read 10207 consistent read transactions' status report 10208 consistent read loop check 10209 enable simulated error on control file 10210 check data block integrity 10211 check index block integrity 10212 check cluster integrity 10213 crash after control file write 10214 simulate write errors on control file 10215 simulate read errors on control file 10216 dump control file header 10217 debug sequence numbers 10218 dump uba of applied undo 10219 monitor multi-pass row locking 10220 show updates to the transaction table 10221 show changes done with undo 10222 row cache 10223 transaction layer - turn on verification codes 10226 trace CR applications of undo for data operations 10227 verify (multi-piece) row structure 10228 trace application of redo by kcocbk 10230 check redo generation by copying before applying 10231 skip corrupted blocks on _table_scans_ 10232 dump corrupted blocks symbolically when kcbgotten 10233 skip corrupted blocks on index operations 10234 trigger event after calling kcrapc to do redo N times 10235 check memory manager internal structures 10236 library cache manager 10237 simulate ^C (for testing purposes) 10238 instantiation manager 10239 multi-instance library cache manager 10240 dump dba's of blocks that we wait for 10241 dump SQL generated for remote execution (OPIX) 10243 simulated error for test %s of K2GTAB latch cleanup 10244 make tranids in error msgs print as 0.0.0 (for testing) 10245 simulate lock conflict error for testing PMON 10246 print trace of PMON actions to trace file 10247 Turn on scgcmn tracing. (VMS ONLY) 10248 turn on tracing for dispatchers 10249 turn on tracing for multi-stated servers 10250 Trace all allocate and free calls to the topmost SGA heap 10251 check consistency of transaction table and undo block 10252 simulate write error to data file header 10253 simulate write error to redo log 10254 trace cross-instance calls 10256 turn off multi-threaded server load balancing 10257 trace multi-threaded server load balancing 10258 force shared servers to be chosen round-robin 10259 get error message text from remote using explicit call 10260 Trace calls to SMPRSET (VMS ONLY) 10261 Limit the size of the PGA heap 10262 Don't check for memory leaks 10263 Don't free empty PGA heap extents 10264 Collect statistics on context area usage (x$ksmcx) 10265 Keep random system generated output out of error messages 10266 Trace OSD stack usage 10267 Inhibit KSEDMP for testing 10268 Don't do forward coalesce when deleting extents 10269 Don't do coalesces of free space in SMON 10270 Debug shared cursors 10271 distributed transaction after COLLECT 10272 distributed transaction before PREPARE 10273 distributed transaction after PREPARE 10274 distributed transaction before COMMIT 10275 distributed transaction after COMMIT 10276 distributed transaction before FORGET 10277 Cursor sharing (or not) related event (used for testing) 10281 maximum time to wait for process creation 10282 Inhibit signalling of other backgrounds when one dies 10286 Simulate control file open error 10287 Simulate archiver error 10288 Do not check block type in ktrget 10289 Do block dumps to trace file in hex rather than fromatted 10290 kdnchk - checkvalid event - not for general purpose use. 10291 die in dtsdrv to test controlfile undo" 10292 dump uet entries on a 1561 from dtsdrv" 10293 dump debugging information when doing block recovery" 10294 enable PERSISTENT DLM operations on non-compliant systems" 10300 disable undo compatibility check at database open 10301 Enable LCK timeout table consistency check" 10320 Enable data layer (kdtgrs) tracing of space management calls" 10352 report direct path statistics 10353 number of slots 10354 turn on direct read path for parallel query 10355 turn on direct read path for scans 10356 turn on hint usage for direct read 10357 turn on debug information for direct path 10374 parallel query server interrupt (validate lock value) 10375 turn on checks for statistics rollups 10376 turn on table queue statistics 10377 turn off load balancing 10379 direct read for rowid range scans (unimplemented) 10380 kxfp latch cleanup testing event 10381 kxfp latch cleanup testing event 10382 parallel query server interrupt (reset) 10383 auto parallelization testing event 10384 parallel dataflow scheduler tracing 10385 parallel table scan range sampling method 10386 parallel SQL hash and range statistics 10387 parallel query server interrupt (normal) 10388 parallel query server interrupt (failure) 10389 parallel query server interrupt (cleanup) 10390 Trace parallel query slave execution 10391 trace rowid range partitioning 10392 parallel query debugging bits 10393 print parallel query statistics 10394 allow parallelization of small tables 10395 adjust sample size for range table queues 10396 circumvent range table queues for queries 10397 suppress verbose parallel coordinator error reporting 10398 enable timeouts in parallel query threads 10399 use different internal maximum buffer size 10400 turn on system state dumps for shutdown debugging 10500 turn on traces for SMON 10510 turn off SMON check to offline pending offline rollbacksegment 10511 turn off SMON check to cleanup undo dictionary 10512 turn off SMON check to shrink rollback segments 10600 check cursor frame. allocation 10602 cause an access violation (for testing purposes) 10603 cause an error to occur during truncate (for testing purposes) 10604 trace parallel create index 10605 enable parallel create index by default 10606 trace parallel create index 10607 trace index rowid partition scan 10608 trace create bitmap index 10610 trace create index pseudo optimizer 10666 Do not get database enqueue name 10667 Cause sppst to check for valid process ids 10690 Set shadow process core file dump type (Unix only) 10691 Set background process core file type (Unix only) 10700 Alter access violation exception handler 10701 Dump direct loader index keys 10702 Enable histogram data generation 10703 Simulate process death during enqueue get 10704 Print out information about what enqueues are being obtained 10706 Print out information about instance lock manipulation 10707 Simulate process death for instance registration 10708 Print out Tracing information for skxf multi instance comms 10709 enable parallel instances in create index by default 10710 trace bitmap index access 10711 trace bitmap index merge 10712 trace bitmap index or 10713 trace bitmap index and 10714 trace bitmap index minus 10715 trace bitmap index conversion to rowids 10800 disable Smart Disk scan 10801 enable Smart Disk trace 10802 reserved for Smart Disk 10803 write timing statistics on OPS recovery scan 10804 reserved for ksxb 10805 reserved for row source sort 10900 extent manager fault insertion event #%s 10924 import storage parse error ignore event 10925 trace name context forever 10926 trace name context forever 10927 trace name context forever 10928 trace name context forever 10999 do not get database enqueue name
-
No Comments » 10046 level oracle trace

Comments