此文章主要讲述的是在DB2数据库中安装sample数据库与TOLLSDB数据库的正确操作步骤,以及对安装sample数据库与TOLLSDB数据库是我的小的细节操作的介绍,以下就是文章的主要内容讲述。

数据库, sample, TOLLSDB数据库, sample, TOLLSDB

安装示例数据库和TOOLSDB数据库:

安装完成后,欲登陆sample数据库和toolsdb,发现出错:

    db2=>connecttosample SQL1031NThedatabasedirectorycannotbefoundontheindicatedfilesystem. db2=>connecttotoolsdb SQL1031NThedatabasedirectorycannotbefoundontheindicatedfilesystem.

1、 猜想DB2数据库未安装,查看/hom/db2inst1目录下的,仅有sqllib文件夹:

    [db2inst1@localhost~]$ls sqllib

对比下其他学员的情况,发现本人的服务器上少了一个db2inst1目录:

    [db2inst1@localhost~]$ls db2inst1sqllib

2、下面手动对两个数据库进行创建:

2.1、创建示例数据库:

    [db2inst1@localhost~]$db2sampl Creatingdatabase"SAMPLE"... Connectingtodatabase"SAMPLE"... Creatingtablesanddatainschema"DB2INST1"... CreatingtableswithXMLcolumnsandXMLdatainschema"DB2INST1"... 'db2sampl'processingcomplete.

2.2、创建toolsbd数据库:

    [db2inst1@localhostNODE0000]$db2createtoolscatalogsystoolscreatenewdatabasetoolsdb DB20000ITheCREATETOOLSCATALOGcommandcompletedsuccessfully.

2.3、确认相应DB2数据库文件创建的情况:

    [db2inst1@localhostNODE0000]$cd [db2inst1@localhost~]$ls db2inst1sqllib [db2inst1@localhost~]$cddb2inst1/ [db2inst1@localhostdb2inst1]$ls NODE0000 [db2inst1@localhostdb2inst1]$cdNODE0000/ [db2inst1@localhostNODE0000]$ls SAMPLESQL00001SQL00002sqldbdirTOOLSDB

2.4、登陆数据库。首先登陆到sample,然后断开与该数据库的连接,再连接到toolsdb:

    [db2inst1@localhostNODE0000]$db2 (c)CopyrightIBMCorporation1993,2007 CommandLineProcessorforDB2Client9.7.1 YoucanissuedatabasemanagercommandsandSQLstatementsfromthecommand prompt.Forexample: db2=>connecttosample db2=>bindsample.bnd Forgeneralhelp,type:?. Forcommandhelp,type:?command,wherecommandcanbe thefirstfewkeywordsofadatabasemanagercommand.Forexample: ?CATALOGDATABASEforhelpontheCATALOGDATABASEcommand ?CATALOGforhelponalloftheCATALOGcommands. Toexitdb2interactivemode,typeQUITatthecommandprompt.Outside interactivemode,allcommandsmustbeprefixedwith'db2'. Tolistthecurrentcommandoptionsettings,typeLISTCOMMANDOPTIONS. Formoredetailedhelp,refertotheOnlineReferenceManual. db2=>connecttosample DatabaseConnectionInformation Databaseserver=DB2/LINUX9.7.1 SQLauthorizationID=DB2INST1Localdatabasealias=SAMPLEdb2=>disconnectsample DB20000ITheSQLDISCONNECTcommandcompletedsuccessfully. db2=>connecttotoolsdb DatabaseConnectionInformation Databaseserver=DB2/LINUX9.7.1 SQLauthorizationID=DB2INST1Localdatabasealias=TOOLSDB

以上的相关内容就是对DB2数据库中安装sample数据库和TOLLSDB数据库的介绍,望你能有所收获。