使用redis-cli迁移数据

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/huyangg/article/details/79218090
开启现有 Redis 实例的 AOF 功能(如果实例已经启用 AOF 功能则忽略此步骤)。  
# redis-cli -h old_instance_ip -p old_instance_port config set appendonly yes


通过 AOF 文件将数据导入到新的云数据库 Redis 版实例 (假定生成的 AOF 文件名为 appendonly.aof)。


# redis-cli -h aliyun_redis_instance_ip -p 6379 -a password --pipe < appendonly.aof


注意:如果原有旧的 Redis 实例不需要一直开启 AOF,可在导入完成后通过以下命令关闭。

# redis-cli -h old_instance_ip -p old_instance_port config set appendonly no

参考文章:

https://help.aliyun.com/document_detail/26357.html?spm=5176.doc66012.6.590.SzoRwT

展开阅读全文

迁移AWR数据

01-18

目的:在不同的系统中传输AWR数据。rn例如:rn 需要在测试环境测试生产中的性能问题,需要生产环境的AWR数据。对生产环境不会造成影响。rn形成一个AWR数据库。生产环境的AWR报告可由此生成。rnrn**************************************************************************************rn方法一:通过SQL脚本导出导入AWR数据rn**************************************************************************************rn导出AWR数据rn1. 在SQL提示符下,输入导出命令:rnSQL> @$ORACLE_HOME/rdbms/admin/awrextr.sqlrnrn2. 指定将要导出AWR数据的数据库IDrnEnter value for db_id: 1377863381rnrn3. 指定想要导出的天数,对应的snapshot会列出:rnEnter value for num_days: 2rnrn4. 指定要导出的AWR数据的起始和终止snapshot ID:rnEnter value for begin_snap: 30 rnEnter value for end_snap: 40rnA list of directory objects is displayed.rnrn5. 指定存放导出文件的路径(要导出到指定路径,导出路径需要提前创建)。rnrn6. 指定导出文件名(.dmp后缀会自动追加):rnEnter value for file_name: awrdata_30_40rnrn7. 执行导出,查看导出日志确定导出是否成功。rnrnrn加载AWR数据rn1. 在SQL提示符下,输入命令:rnSQL> @$ORACLE_HOME/rdbms/admin/awrload.sqlrnrn2. 指定导出文件的存放路径:rnEnter value for directory_name: DATA_PUMP_DIRrnIn this example, the directory object DATA_PUMP_DIR is selected.rnrn3. 指定导出文件名(.dmp后缀会自动追加):rnEnter value for file_name: awrdata_30_40rnIn this example, the export dump file named awrdata_30_40 is selected.rnrn4. 指定AWR数据加载的临时schema:rnEnter value for schema_name: AWR_STAGErnrn5. 指定临时schema的默认表空间:rnEnter value for default_tablespace: SYSAUXrnrn6. 指定临时schema的temporary 表空间:rnEnter value for temporary_tablespace: TEMPrnrn7. 名为AWR_STAGE的临时schema被创建,AWR数据将被加载到该schema下,完成后,数据被转移到SYS schema的AWR表中(数据加载完后,临时schema自动被删除):rnProcessing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINTrnCompleted 113 CONSTRAINT objects in 11 secondsrnProcessing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINTrnCompleted 1 REF_CONSTRAINT objects in 1 secondsrnJob "SYS"."SYS_IMPORT_FULL_03" successfully completed at 09:29:30rn... Dropping AWR_STAGE userrnEnd of AWR Loadrnrnrn**************************************************************************************rn方法二:通过存储过程导出导入AWR数据rn**************************************************************************************rn导出rnbeginrnDBMS_SWRF_INTERNAL.AWR_EXTRACT (rn dmpfile => 'awr_data.dmp',rn dmpdir => 'TMP_DIR',rn bid => 302,rn eid => 305rn);rnend;rn/rndmpfile 指定导出文件的文件名,默认为awrdat.dmprndmpdir 指定导出文件的路径名(导出路径需要预先创建)。rnbid 指定导出的起始snapshot IDrneid 指定导出的终止snapshot IDrnrn查看当前snapshotrnSQL> select snap_id,dbid from dba_hist_snapshot order by snap_id;rnrn删除指定范围的snapshotrnBEGINrnDBMS_WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE (low_snap_id => 93, rnhigh_snap_id => 98, dbid => 1244006465);rnEND;rn/rn删除snapshot的同时,指定范围内的Active Session History data (ASH) 的数据同时也被purgernrn导入:rn先导入临时schemarnbeginrnDBMS_SWRF_INTERNAL.AWR_LOAD (rn SCHNAME => 'ARUP',rn dmpfile => 'awr_data',rn dmpdir => 'TMP_DIR'rn);rnend;rn/rnrn导入到sys schemarnbeginrnDBMS_SWRF_INTERNAL.MOVE_TO_AWR (rn SCHNAME => 'ARUP'rn);rnend;rn/rn 论坛

Struts+hibernate实现数据迁移

09-09

rn处理类rn其中person和user是数据库表大映射类rn/*rn * Generated by MyEclipse Strutsrn * Template path: templates/java/JavaClass.vtlrn */rnpackage com.translate.struts.action;rnrnimport java.util.ArrayList;rnimport java.util.List;rnrnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport org.apache.struts.action.Action;rnimport org.apache.struts.action.ActionForm;rnimport org.apache.struts.action.ActionForward;rnimport org.apache.struts.action.ActionMapping;rnimport org.hibernate.Criteria;rnimport org.hibernate.Session;rnimport org.hibernate.Transaction;rnrnimport com.login.po.Person;rnimport com.login.po.User;rnimport com.traslate.hb.HibernateSessionFactory;rnrn/** rn * MyEclipse Strutsrn * Creation date: 09-09-2008rn * rn * XDoclet definition:rn * @struts.action input="/translate.jsp" validate="true"rn * @struts.action-forward name="success" path="/translate.jsp" contextRelative="true"rn */rnpublic class TranslateAction extends Action rn /*rn * Generated Methodsrn */rnrn /** rn * Method executern * @param mappingrn * @param formrn * @param requestrn * @param responsern * @return ActionForwardrn */rn public ActionForward execute(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response) rn // TODO Auto-generated method stubrn Session session = HibernateSessionFactory.getSession();rn Criteria c = session.createCriteria(User.class);rn List userList = c.list();rn if(userList.size() < 0)rn return mapping.findForward("failure");rn elsern rn Transaction tx = session.beginTransaction();rn tryrn ArrayList alist = new ArrayList();rn //Person[] p = new Person[userList.size()-1];rn for(int i=0; i 论坛

没有更多推荐了,返回首页