附加Informix .dat和.idx文件

时间:2021-07-08 23:16:48

We are trying to duplicate one of our informix database on a test server, but without Informix expertise in house we can only guess what we need to do. I am learning this stuff on the fly myself and nowhere near the expertise level needed to operate Informix efficiently or even inefficiently. Anyhow... We managed to copy the .dat and .idx files from the live server somewhere. Installed Linux and the latest Informix Dynamic Server on it and have it up and running.

我们正在尝试在测试服务器上复制我们的informix数据库之一,但如果没有内部的Informix专业知识,我们只能猜测我们需要做什么。我自己动手学习这些东西,远远没有达到高效甚至低效运行Informix所需的专业水平。无论如何......我们设法从某个地方的实时服务器复制.dat和.idx文件。在其上安装了Linux和最新的Informix Dynamic Server,并将其启动并运行。

Now what should we do with the .dat and idx files from the live server? Do we copy it somewhere and it will recognize it automatically?

现在我们应该如何处理来自实时服务器的.dat和idx文件?我们将它复制到某个地方并自动识别吗?

Or is there an equivalent way like you can do attach DB from MS SQLServer to register the database files in the new database?

或者是否有类似的方法可以从MS SQLServer附加数据库以在新数据库中注册数据库文件?

At my rope end...

在我的绳子端......

4 个解决方案

#1


1  

You've asked a pretty complicated question without realizing it. Informix is architected as a shared everything database engine, meaning all resources available to the instance are available to every database in that instance. This means that more than one database can store data in any given dbspace, .dat or .idx file in your case. Most DBA's know better than to do that but it's something to be aware of. Given this knowledge you now know that the .dat and .idx files do not belong to a database but belong the instance. The dbspaces and files were created to contain your databases data but they technically belong to the instance. It's worth noting that the .dat and .idx files are known to the database by the logical dbspace name.

你没有意识到这个问题就问了一个非常复杂的问题。 Informix被构建为共享所有数据库引擎,这意味着实例可用的所有资源都可用于该实例中的每个数据库。这意味着多个数据库可以在您的案例中的任何给定dbspace,.dat或.idx文件中存储数据。大多数DBA都知道比这更好,但这是需要注意的事情。鉴于此知识,您现在知道.dat和.idx文件不属于数据库但属于实例。创建dbspace和文件以包含数据库数据,但它们在技术上属于实例。值得注意的是,逻辑dbspace名称使数据库知道.dat和.idx文件。

Armed with this background info and assuming that the production and development servers are running the same OS and that your hardware is relatively the same, not a combination of PARISC, Itanium or x86/x64, I'll throw a couple of options out for you.

有了这个背景信息并假设生产和开发服务器运行相同的操作系统并且您的硬件相对相同,而不是PARISC,Itanium或x86 / x64的组合,我会为您抛出几个选项。

  1. Create the dbspaces that you need in the new instance and use onunload and onload to copy the database from production to development.
  2. 在新实例中创建所需的dbspace,并使用onunload和onload将数据库从生产复制到开发。

  3. Use ontape or onbar to backup the entire production instance and restore it over your development instance.
  4. 使用ontape或onbar备份整个生产实例并将其还原到开发实例上。

Option 1 requires that you know what the dbspaces are named and how large they are. Use onstat -d on the production instance to find this out. BTW, the numbers listed in onstat -d are in pages, I believe that Linux is a 2K page.

选项1要求您知道dbspace的名称以及它们的大小。在生产实例上使用onstat -d来查找它。顺便说一下,onstat -d中列出的数字是在页面中,我相信Linux是一个2K的页面。

Option 2 simply requires that the paths for the data files are the same on both servers. This means that the ROOTDBS needs to be the same in both instances. That can be found by executing onstat -c | grep ROOTDBS

选项2只要求两个服务器上的数据文件路径相同。这意味着ROOTDBS在两个实例中都需要相同。这可以通过执行onstat -c |找到grep ROOTDBS

There's a lot that has been left out but I hope that this gives you the info that you need to move forward with your task.

有很多事情被遗漏了,但我希望这能为您提供继续完成任务所需的信息。

#2


1  

The .dat and .idx files are associated with C-ISAM, or, when organized in a directory called dbase.dbs (where dbase is the name of your database), the .dat and .idx files are associated with Informix Standard Engine, aka Informix SE. SE uses C-ISAM to manage its storage. SE is rather different from (and much simpler than) Informix Dynamic Server (IDS). It is not impossible that the .dat and .idx files are associated with IDS; it is just extremely unlikely.

.dat和.idx文件与C-ISAM相关联,或者,当组织在名为dbase.dbs的目录中时(其中dbase是数据库的名称),.dat和.idx文件与Informix Standard Engine相关联,又名Informix SE。 SE使用C-ISAM来管理其存储。 SE与Informix Dynamic Server(IDS)有很大的不同(并且比它简单得多)。 .dat和.idx文件与IDS相关联并非不可能;这是极不可能的。

From the information available, it sounds as though your production server is running SE. To get the data from SE to IDS, you will probably want to use DB-Export at the SE end and DB-Import at the Linux/IDS end. Certainly, that is the simplest way to do it.

根据可用信息,听起来好像您的生产服务器正在运行SE。要将数据从SE获取到IDS,您可能希望在SE端使用DB-Export,在Linux / IDS端使用DB-Import。当然,这是最简单的方法。

There are other possible solutions - C-ISAM datablade being one such - but they are more expensive and probably not warranted. There are other possible loading solutions, such as HPL (High-Performance Loader).

还有其他可能的解决方案--C-ISAM数据库就是其中之一 - 但它们更昂贵且可能无法保证。还有其他可能的加载解决方案,例如HPL(高性能加载器)。

For more information about Informix, either use the various web sites already referenced (http://www.informix.com is a link to the Informix section of IBM's web site), or use the International Informix User Group (IIUG) web site. There are mailing lists available (which require you to belong, but membership is free) for discussing Informix in detail.

有关Informix的更多信息,请使用已引用的各种网站(http://www.informix.com是IBM网站的Informix部分的链接),或使用International Informix用户组(IIUG)网站。有详细讨论Informix的邮件列表(需要您归属,但会员资格是免费的)。

#3


1  

Those Informix-SE datafiles (.DAT) and their associated index files (.IDX) are useless unless you also have all the associated catalog files, such as SYSTABLES.DAT SYSTABLES.IDX, SYSCOLUMNS, SYSINDEXES, etc.

除非您还拥有所有关联的目录文件,例如SYSTABLES.DAT SYSTABLES.IDX,SYSCOLUMNS,SYSINDEXES等,否则那些Informix-SE数据文件(.DAT)及其关联的索引文件(.IDX)将无法使用。

Then you also have to worry about which version of Informix-SE created them, as some have a 2K or 4K index file node size.

然后,您还必须担心Informix-SE的哪个版本创建了它们,因为有些版本具有2K或4K索引文件节点大小。

Your best approach is to obtain all the .DAT and .IDX files from the source db, plus the correct standard engine, installed on the same hardware and operating system it came from.

您最好的方法是从源数据库中获取所有.DAT和.IDX文件,以及安装在它所来自的相同硬件和操作系统上的正确标准引擎。

Long story short, on the source machine, run "dbexport" to unload all the data to ascii files, and run "dbschema" to generate all the table schemas and indexes. It also wouldn't hurt to run a "bcheck" on all the files before unloading them to ascii flat files.

简而言之,在源机器上,运行“dbexport”将所有数据卸载到ascii文件,并运行“dbschema”以生成所有表模式和索引。在将它们卸载到ascii平面文件之前对所有文件运行“bcheck”也没有什么坏处。

#4


0  

I don't have any Informix-specific advice but for situations like this you can usually find the answer by looking up how to move a database (a common admin task, and usually well described in the manual) and just skipping the steps that would remove the old database.

我没有任何特定于Informix的建议,但是对于这样的情况,你通常可以通过查找如何移动数据库(一个常见的管理任务,通常在手册中有详细描述)找到答案,然后跳过将要执行的步骤删除旧数据库。

Also, be careful of problems caused by different system architectures; some DBs fail spectacularly if you move them from a big-endian system (such as Solaris) to a little-endian system (such as x86 Linux) Again, the manual section on moving a DB would cover any extra steps that are needed.

另外,要注意不同系统架构引起的问题;如果将它们从大端系统(例如Solaris)移动到小端系统(例如x86 Linux),某些DB会失败。同样,移动数据库的手册部分将涵盖所需的任何额外步骤。

#1


1  

You've asked a pretty complicated question without realizing it. Informix is architected as a shared everything database engine, meaning all resources available to the instance are available to every database in that instance. This means that more than one database can store data in any given dbspace, .dat or .idx file in your case. Most DBA's know better than to do that but it's something to be aware of. Given this knowledge you now know that the .dat and .idx files do not belong to a database but belong the instance. The dbspaces and files were created to contain your databases data but they technically belong to the instance. It's worth noting that the .dat and .idx files are known to the database by the logical dbspace name.

你没有意识到这个问题就问了一个非常复杂的问题。 Informix被构建为共享所有数据库引擎,这意味着实例可用的所有资源都可用于该实例中的每个数据库。这意味着多个数据库可以在您的案例中的任何给定dbspace,.dat或.idx文件中存储数据。大多数DBA都知道比这更好,但这是需要注意的事情。鉴于此知识,您现在知道.dat和.idx文件不属于数据库但属于实例。创建dbspace和文件以包含数据库数据,但它们在技术上属于实例。值得注意的是,逻辑dbspace名称使数据库知道.dat和.idx文件。

Armed with this background info and assuming that the production and development servers are running the same OS and that your hardware is relatively the same, not a combination of PARISC, Itanium or x86/x64, I'll throw a couple of options out for you.

有了这个背景信息并假设生产和开发服务器运行相同的操作系统并且您的硬件相对相同,而不是PARISC,Itanium或x86 / x64的组合,我会为您抛出几个选项。

  1. Create the dbspaces that you need in the new instance and use onunload and onload to copy the database from production to development.
  2. 在新实例中创建所需的dbspace,并使用onunload和onload将数据库从生产复制到开发。

  3. Use ontape or onbar to backup the entire production instance and restore it over your development instance.
  4. 使用ontape或onbar备份整个生产实例并将其还原到开发实例上。

Option 1 requires that you know what the dbspaces are named and how large they are. Use onstat -d on the production instance to find this out. BTW, the numbers listed in onstat -d are in pages, I believe that Linux is a 2K page.

选项1要求您知道dbspace的名称以及它们的大小。在生产实例上使用onstat -d来查找它。顺便说一下,onstat -d中列出的数字是在页面中,我相信Linux是一个2K的页面。

Option 2 simply requires that the paths for the data files are the same on both servers. This means that the ROOTDBS needs to be the same in both instances. That can be found by executing onstat -c | grep ROOTDBS

选项2只要求两个服务器上的数据文件路径相同。这意味着ROOTDBS在两个实例中都需要相同。这可以通过执行onstat -c |找到grep ROOTDBS

There's a lot that has been left out but I hope that this gives you the info that you need to move forward with your task.

有很多事情被遗漏了,但我希望这能为您提供继续完成任务所需的信息。

#2


1  

The .dat and .idx files are associated with C-ISAM, or, when organized in a directory called dbase.dbs (where dbase is the name of your database), the .dat and .idx files are associated with Informix Standard Engine, aka Informix SE. SE uses C-ISAM to manage its storage. SE is rather different from (and much simpler than) Informix Dynamic Server (IDS). It is not impossible that the .dat and .idx files are associated with IDS; it is just extremely unlikely.

.dat和.idx文件与C-ISAM相关联,或者,当组织在名为dbase.dbs的目录中时(其中dbase是数据库的名称),.dat和.idx文件与Informix Standard Engine相关联,又名Informix SE。 SE使用C-ISAM来管理其存储。 SE与Informix Dynamic Server(IDS)有很大的不同(并且比它简单得多)。 .dat和.idx文件与IDS相关联并非不可能;这是极不可能的。

From the information available, it sounds as though your production server is running SE. To get the data from SE to IDS, you will probably want to use DB-Export at the SE end and DB-Import at the Linux/IDS end. Certainly, that is the simplest way to do it.

根据可用信息,听起来好像您的生产服务器正在运行SE。要将数据从SE获取到IDS,您可能希望在SE端使用DB-Export,在Linux / IDS端使用DB-Import。当然,这是最简单的方法。

There are other possible solutions - C-ISAM datablade being one such - but they are more expensive and probably not warranted. There are other possible loading solutions, such as HPL (High-Performance Loader).

还有其他可能的解决方案--C-ISAM数据库就是其中之一 - 但它们更昂贵且可能无法保证。还有其他可能的加载解决方案,例如HPL(高性能加载器)。

For more information about Informix, either use the various web sites already referenced (http://www.informix.com is a link to the Informix section of IBM's web site), or use the International Informix User Group (IIUG) web site. There are mailing lists available (which require you to belong, but membership is free) for discussing Informix in detail.

有关Informix的更多信息,请使用已引用的各种网站(http://www.informix.com是IBM网站的Informix部分的链接),或使用International Informix用户组(IIUG)网站。有详细讨论Informix的邮件列表(需要您归属,但会员资格是免费的)。

#3


1  

Those Informix-SE datafiles (.DAT) and their associated index files (.IDX) are useless unless you also have all the associated catalog files, such as SYSTABLES.DAT SYSTABLES.IDX, SYSCOLUMNS, SYSINDEXES, etc.

除非您还拥有所有关联的目录文件,例如SYSTABLES.DAT SYSTABLES.IDX,SYSCOLUMNS,SYSINDEXES等,否则那些Informix-SE数据文件(.DAT)及其关联的索引文件(.IDX)将无法使用。

Then you also have to worry about which version of Informix-SE created them, as some have a 2K or 4K index file node size.

然后,您还必须担心Informix-SE的哪个版本创建了它们,因为有些版本具有2K或4K索引文件节点大小。

Your best approach is to obtain all the .DAT and .IDX files from the source db, plus the correct standard engine, installed on the same hardware and operating system it came from.

您最好的方法是从源数据库中获取所有.DAT和.IDX文件,以及安装在它所来自的相同硬件和操作系统上的正确标准引擎。

Long story short, on the source machine, run "dbexport" to unload all the data to ascii files, and run "dbschema" to generate all the table schemas and indexes. It also wouldn't hurt to run a "bcheck" on all the files before unloading them to ascii flat files.

简而言之,在源机器上,运行“dbexport”将所有数据卸载到ascii文件,并运行“dbschema”以生成所有表模式和索引。在将它们卸载到ascii平面文件之前对所有文件运行“bcheck”也没有什么坏处。

#4


0  

I don't have any Informix-specific advice but for situations like this you can usually find the answer by looking up how to move a database (a common admin task, and usually well described in the manual) and just skipping the steps that would remove the old database.

我没有任何特定于Informix的建议,但是对于这样的情况,你通常可以通过查找如何移动数据库(一个常见的管理任务,通常在手册中有详细描述)找到答案,然后跳过将要执行的步骤删除旧数据库。

Also, be careful of problems caused by different system architectures; some DBs fail spectacularly if you move them from a big-endian system (such as Solaris) to a little-endian system (such as x86 Linux) Again, the manual section on moving a DB would cover any extra steps that are needed.

另外,要注意不同系统架构引起的问题;如果将它们从大端系统(例如Solaris)移动到小端系统(例如x86 Linux),某些DB会失败。同样,移动数据库的手册部分将涵盖所需的任何额外步骤。