backup control file :
SQL> alter database backup controlfile to trace;
it will generate sid_ora_XXXX.trc at "C:\oracle\product\10.2.0\admin\orcl\udump"
backup tablespace and datafile file:
SQL> spool c:\work_dump/spoolback.txt
SQL> select * from dba_tablespaces;
SQL> select * from dba_data_files;
SQL> spool off;
SQL> exit
DB dump :
C:\Documents and Settings\Administrator>exp system/oracle full=y file="c:/work_d
ump/joseph_'yourDate'.dump" statistics=none inctype=complete
in Linux 'yourDate' can be "date+%Y%m%d%H%M%S"
So we have three file and backup it up to another disk !
2010年6月14日 星期一
LockMode in DAO of Hibernate
public ProfileVO getProfilebyLoginIdLockMode(final String loginId){
ProfileVO vo = null;
List list = (List)this.getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(org.hibernate.Session session) throws HibernateException, SQLException {
Criteria cri=session.createCriteria(ProfileVO.class,"p");
cri.add(Restrictions.eq("p.loginId", loginId)).setLockMode(LockMode.FORCE);
return cri.list();
}
});
if(list.size()>0){
vo = (ProfileVO)list.get(0);
}
return vo;
}
do not use the following method , because it will get a new persistent context and lock will be failure !
...
Session session = this.getHibernateTemplate().getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
Query query = session.createQuery("from ProfileVO p where p.loginId='"+loginId+"'").setLockMode("p", LockMode.FORCE);
List list1 = query.list();
if(list1.size()>0){
vo = (ProfileVO)list1.get(0);
}
tx.commit();
session.close();
ProfileVO vo = null;
List list = (List)this.getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(org.hibernate.Session session) throws HibernateException, SQLException {
Criteria cri=session.createCriteria(ProfileVO.class,"p");
cri.add(Restrictions.eq("p.loginId", loginId)).setLockMode(LockMode.FORCE);
return cri.list();
}
});
if(list.size()>0){
vo = (ProfileVO)list.get(0);
}
return vo;
}
do not use the following method , because it will get a new persistent context and lock will be failure !
...
Session session = this.getHibernateTemplate().getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
Query query = session.createQuery("from ProfileVO p where p.loginId='"+loginId+"'").setLockMode("p", LockMode.FORCE);
List list1 = query.list();
if(list1.size()>0){
vo = (ProfileVO)list1.get(0);
}
tx.commit();
session.close();
2010年5月19日 星期三
jquery getJSON
Jquery的1.4版之後在處理JSON和之前版本有差異
這次就是在處理時是用單引號,但1.4之後強制跟正規的JSON走(要用雙引號),
所以若用單引號會發現
這次就是在處理時是用單引號,但1.4之後強制跟正規的JSON走(要用雙引號),
所以若用單引號會發現
$.getJSON的callback會沒有作用
請參閱2010年5月7日 星期五
Quartz在Spring中指定方法並帶參數
< id="jobDetailBean" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
< name="targetObject">
< bean="synSellingDataJob">
< /property >
< name="targetMethod">
<>execute
< /property >
< name="arguments">
<>
< type="java.lang.String ">Joseph< /value >
< type="java.lang.String">I love you< /value >
< /list >
< /property >
< /bean >
code :
public void execute(Object[] obj){
....
}
2010年4月30日 星期五
生活記事7-11 i-bon好方便
今年四月幫小可換駕照,到7-11一切搞定!
準備 : 身份證正反影本、舊駕照正反影本、照片一張、現金(換照錢、影印、掃描)兩百五六十吧~忘了
先去i-bon選擇換照的項目,會印出來、然後把以上的東西都貼上去,掃描傳送出去就完成了 !
身份證影本和照片都可以再利用 !
過幾天新照就會寄過來了~~而且照片還是彩色的喔 ! 真cool ! 方便 ! 讚啦 !
準備 : 身份證正反影本、舊駕照正反影本、照片一張、現金(換照錢、影印、掃描)兩百五六十吧~忘了
先去i-bon選擇換照的項目,會印出來、然後把以上的東西都貼上去,掃描傳送出去就完成了 !
身份證影本和照片都可以再利用 !
過幾天新照就會寄過來了~~而且照片還是彩色的喔 ! 真cool ! 方便 ! 讚啦 !
2010年4月14日 星期三
Maven in eclipse - M2eclipse
某天某專案下的Maven dependencies不見了,在該專案下的.classpath補上
classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"
就恢復了
就恢復了
2010年4月11日 星期日
TransactionException in Hibernate and MySQL
在過一段時間後會出現如上錯誤訊息,這是因為MySQL已經切斷閒置的連線,所以可以利用connection pool的配置來處理這個問題。Mysql服務器預設的「wait_timeout」是8小時(待查證),所以mysql配置中my.ini 的wait_timeout值一定要大於等於connection pool的idle_timeout 值,否則mysql會在wait_timeout的時間後關閉連接,然而連接池還認為該連接可用,這樣就會產生以上圖內的錯誤。
MySQL :
interactive_timeout=XX
The number of seconds the server waits for activity on an interactive connection before closing it.
wait_timeout=XX
The number of seconds the server waits for activity on a noninteractive connection before closing it.
DBCP
timeBetweenEvictionRunsMillis 每毫秒檢查一次連接池中閒置的連接(spec :The number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.)預設是-1
minEvictableIdleTimeMillis 連接池中連接可閒置的時間(spec:The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any). )
上面兩個設定要一起使用,意思是說每timeBetweenEvictionRunsMillis毫秒檢查一次連接池中空閒的連接,把空閒時間超過 minEvictableIdleTimeMillis毫秒的連接斷開,直到連接池中的連接數到minIdle為止
訂閱:
文章 (Atom)
COVID-19 確診經歷紀實
原本以為真的是天選之人,就算先前家裡兩個小孩都確診都逃過了(可能有中獎但無症狀吧),不過就在2023年六月18日破解自認為天選之人的"心態",為什麼可以確認就是這天中獎的呢?因為在前都是居家上班,到人多的室內場所都會戴口罩,就剛好這天傍晚原本只想說要去附近的國...
-
因為使用alpine的base image,要讓OS的時區改成自己設定就需要額外安裝tzdata套件,再加上公司環境根本不能連外進行安裝,所以想在docker file設定 ENV TZ=“Asia/Taipei” 或mount volumn使用host的時區 /etc/tim...
-
案例: 收到的request資料中一個JSON格式的資料要保存,但為何不存JSON的字串就好?因為這個資料會不斷變動的,所以收到變動只要取出這個已將JSON轉成list的添加或刪除東西就好,不用再將JSON轉成list再轉回JSON存到DB去。 在Hibernate中是設定該欄...
-
公司某PC power supply壞了,過幾天換上新的後居然開不了機, 出現mkrootdev: label / not found mount : error 2 mounting ext3 .... ... Kernel panic - not syncing:Attemp...