MonetDB用户指南4——(资源)Dump and restore
2013-10-23 14:22
288 查看
AnSQLdumpofadatabaseisacommonmethodtosafelystoreawayasnapshotofthedatabaseforarchivalpurposesortomigratedatabetweendatabaseinstances,e.g.betweentwomajorsystemreleases.ThecontentofaSQLdumpisalargecollectionofSQL
commandsinASCII.Runningthescriptwillrecreatethedatabaseinthesamestateasitwaswhenthedumpwascreated.SinceMonetDBdoesnotprovidegloballockingschemes,atime-consumingdumpoperationmaybecomeinvalidatedbyaconcurrentupdatequery.
TheprimarytooltoconsiderformakinganASCIIdumpis
msqldump,whichincludesawidevarietyofoptions.Asimplifiedversionisavailableaspartofthemclientprogram.
SQL转储是对数据库镜像或者迁移的常用的方法。如在两个版本之间。SQLdump是ASCII编码的SQL的集合。执行这些脚本,可以重新创建一样的数据库。MonetDB不提供全局锁,并发情况下这个转储可能无效。
ConsideryouhavealreadyinstalledtheSQLtutorialdatabase
vocandwishtotransportittoanothermachine.Thenthefollowingclientcommandlineoptiongeneratesthedumpfile.
缺人安装了示例VOC库,并且希望迁移到另外一台机器。下面的客户端命令产生一个dump文件。
shell>mclient-lsql--database=voc--dump>/tmp/voc.sql
Youcaninspectthefile/tmp/voc.sqltoconfirmthatindeedareadabledatabasedumpisavailable.Ifstoragespaceisaproblem,youcanreadilypipetheoutputofthiscommandtoacompressiontoolorsentitdirectlytoanother
machineinyourenvironmentusingconventionalLinuxtools.Asabaseline,movethefileovertothenewmachine.Themonetdbtoolcan
beusedtocreatethedatabaseonthatmachine.Oncedone,itsufficestofeedthedumpfiletomclienttopopulatethedatabase.
可以检察/tmp/voc.sql,确认它是可读的。如果空间是问题,可以用管道把输出给一个压缩工具,或者使用linux工具直接发送到另外一台机器,移动数据文件到新机器。MonetDB可以用于创建数据库。
Creationofthedumprespectsyourcredentials,whichmeansyouonlycandumpthetablesyouhaveaccessto.
shell>mclient-lsql--database=voc/tmp/voc.sql
Migrationofadatabasefromothersystemfollowsthesameroute,butbeawarethatSQLdialectsoftendiffer.AmanualorscriptedpatchofaforeignSQLdumpisoftenneeded.
在不同的操作系统,dump方法类似,只是SQL方言经常不一样。
FastbackupsonLinux
AsidefromtheASCIIdumps,onecanalsotakethedatabaseserveroutofproductionusingcommands
shell>monetdbstopdemo
shell>monetdblockdemo
Afterthedatabasehasbeensecurelystopped,wecancreateacopyofthedatabasedirectoryinthedbfarmandputitasideinasafeplace.Alternatively,incrementalfile-systemdumpscanbeusedtoreducethetimeandstoragespaceforarecoverypoint.
Finally,thedatabaseisreleasedforproductionagain.Bewarethattakingasystemoutofproductionshouldbefollowedbyensuringthatallrunningquerieshavefinished.Thiscanbeinspectedusingthesystem
monitor.
TodumptheSQLdatabase,starttheMonetDBSQLClientprogramandtypethecommand
\>...\databasedump.sql
\D
\>
Thepathafter\>shouldbeanabsolutepathname(i.e.startwithadriveletter)andbeinasavelocation.Bydefaultthedatabaseislocatedin
insidethedbfarm\demofolder.
RestoringtheSQLdatabasecanbedoneusingtheMonetDBSQLClientprogramwiththefollowingcommand
commandsinASCII.Runningthescriptwillrecreatethedatabaseinthesamestateasitwaswhenthedumpwascreated.SinceMonetDBdoesnotprovidegloballockingschemes,atime-consumingdumpoperationmaybecomeinvalidatedbyaconcurrentupdatequery.
TheprimarytooltoconsiderformakinganASCIIdumpis
msqldump,whichincludesawidevarietyofoptions.Asimplifiedversionisavailableaspartofthemclientprogram.
SQL转储是对数据库镜像或者迁移的常用的方法。如在两个版本之间。SQLdump是ASCII编码的SQL的集合。执行这些脚本,可以重新创建一样的数据库。MonetDB不提供全局锁,并发情况下这个转储可能无效。
Linuxplatforms
Linux平台ConsideryouhavealreadyinstalledtheSQLtutorialdatabase
vocandwishtotransportittoanothermachine.Thenthefollowingclientcommandlineoptiongeneratesthedumpfile.
缺人安装了示例VOC库,并且希望迁移到另外一台机器。下面的客户端命令产生一个dump文件。
shell>mclient-lsql--database=voc--dump>/tmp/voc.sql
Youcaninspectthefile/tmp/voc.sqltoconfirmthatindeedareadabledatabasedumpisavailable.Ifstoragespaceisaproblem,youcanreadilypipetheoutputofthiscommandtoacompressiontoolorsentitdirectlytoanother
machineinyourenvironmentusingconventionalLinuxtools.Asabaseline,movethefileovertothenewmachine.The
beusedtocreatethedatabaseonthatmachine.Oncedone,itsufficestofeedthedumpfiletomclienttopopulatethedatabase.
可以检察/tmp/voc.sql,确认它是可读的。如果空间是问题,可以用管道把输出给一个压缩工具,或者使用linux工具直接发送到另外一台机器,移动数据文件到新机器。MonetDB可以用于创建数据库。
Creationofthedumprespectsyourcredentials,whichmeansyouonlycandumpthetablesyouhaveaccessto.
shell>mclient-lsql--database=voc/tmp/voc.sql
Migrationofadatabasefromothersystemfollowsthesameroute,butbeawarethatSQLdialectsoftendiffer.AmanualorscriptedpatchofaforeignSQLdumpisoftenneeded.
在不同的操作系统,dump方法类似,只是SQL方言经常不一样。
FastbackupsonLinux
AsidefromtheASCIIdumps,onecanalsotakethedatabaseserveroutofproductionusingcommands
shell>monetdbstopdemo
shell>monetdblockdemo
Afterthedatabasehasbeensecurelystopped,wecancreateacopyofthedatabasedirectoryinthedbfarmandputitasideinasafeplace.Alternatively,incrementalfile-systemdumpscanbeusedtoreducethetimeandstoragespaceforarecoverypoint.
Finally,thedatabaseisreleasedforproductionagain.Bewarethattakingasystemoutofproductionshouldbefollowedbyensuringthatallrunningquerieshavefinished.Thiscanbeinspectedusingthesystem
monitor.
shell>monetdbreleasedemo
Windowsplatforms
ItisrecommendedtoalwaysdumptheolddatabaseintoASCIIbeforeinstallinganewMonetDBrelease.Subsequentlyremovethedbfarm.Afterinstallation,thedumpcanberestored.TodumptheSQLdatabase,starttheMonetDBSQLClientprogramandtypethecommand
\>...\databasedump.sql
\D
\>
Thepathafter\>shouldbeanabsolutepathname(i.e.startwithadriveletter)andbeinasavelocation.Bydefaultthedatabaseislocatedin
%APPDATA%\MonetDB5.Afterhavingmadeadatabasedumpitcanberemoved.Thisfolderislocated
insidethedbfarm\demofolder.
RestoringtheSQLdatabasecanbedoneusingtheMonetDBSQLClientprogramwiththefollowingcommand
\<...\databasedump.sql
相关文章推荐
- MonetDB用户指南4——(资源)OOM killer
- MonetDB用户指南4——(资源)内存使用Memory footprint
- MonetDB用户指南4——(资源)压缩
- MonetDB用户指南4——(资源)磁盘空间
- MonetDB用户指南2——MonetDBServer
- MonetDB用户指南3——Readonly database只读数据库
- MonetDB用户指南5——自动加载脚本
- MonetDB用户指南0——Reader's guide文档阅读指导
- Unity3d用户手册用户指南Mecanim 动画系统资源准备和导入
- MonetDB用户指南1——初始化
- Gradle 1.12用户指南翻译——第五十章. 依赖管理
- iOS开发资源:Helios、THLabel以及AGi18n等(用户账户到消息推送)
- AndroidStudio用户指南之快捷键
- Reviewboard用户指南(1.4)—— Getting Started: Account Settings
- 【Flume NG用户指南】(0)介绍
- Kubernetes用户指南(三)--在生产环境中使用Pod来工作、管理部署
- Reviewboard用户指南(6.1)——Reviewing Diffs
- 修改mysql用户密码及资源限制
- drools用户指南----stateless session(无状态会话)的使用
- jBPM用户指南 第四章 面向图表编程 (转载)