在 Oracle 数据库上执行数据归档的最佳方法是什么?

发布于 2024-08-10 10:37:47 字数 97 浏览 6 评论 0原文

我想找出归档不再需要的数据的最佳方法,以提高应用程序性能并节省磁盘空间。根据您的经验,实现此目的的最佳方法是什么?我可以使用什么样的工具?为此目的开发一个特定的内部应用程序更好吗?

I'd like to figure out the best way to archive the data that is no needed anymore, in order to improve the application performance and also to save disk space. In your experience what is the best way to implement this, what kind of tools can I use? It is better to develop an specific in house application for that purpose?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

屌丝范 2024-08-17 10:37:47

管理归档的一种方法:

  1. 按日期范围对表进行分区,例如每月分区
  2. 随着分区变得过时,例如 36 个月后,这些分区现在可以移动到您的数据仓库,这可能是另一个仅包含文本文件的数据库,具体取决于您的访问权限需要。
  3. 移动后,过时的分区可以从主数据库中删除,因此始终仅维护(例如)36 个月的当前数据。
  4. 所有这些都可以使用 SQL/Shell 脚本的混合来自动化。

One way to manage archiving:

  1. Partition your tables on date range, e.g. monthly partitions
  2. As partitions become obsolete, e.g. after 36 months, those partitions can now be moved to your data warehouse, which could be another database of just text files depending upon your access needs.
  3. After moving, the obsolete partitions can be removed from your primary database, so always maintaining just (e.g.) 36 months of current data.
  4. All this can be automated using a mix of SQL/Shell scripts.
梦毁影碎の 2024-08-17 10:37:47

在 ORACLE 数据库中归档旧数据的最佳方法是:

  1. 根据日期或大小定义归档和保留策略。
  2. 根据定义的策略将可归档数据导出到外部表(表空间)。
  3. 压缩外部表并将其存储在更便宜的存储介质中。
  4. 使用 SQL DELETE 从活动数据库中删除存档数据。
  5. 然后执行以下命令来清理空间:
    alter table T_XYZ 启用行移动;
    改变表T_XYZ收缩空间;
  6. 如果您仍然想释放一些磁盘空间回操作系统(因为 Oracle 现在保留了之前使用的总空间),那么您可能必须调整数据文件本身的大小:
    SQL>更改数据库数据文件'/home/oracle/database/../XYZ.dbf'调整大小1m;

更多详情请参考:

The best way to archive old data in ORACLE database is:

  1. Define an archive and retention policy based on date or size.
  2. Export archivable data to an external table (tablespace) based on a defined policy.
  3. Compress the external table and store it in a cheaper storage medium.
  4. Delete the archived data from your active database using SQL DELETE.
  5. Then to clean up the space execute the below commands:
    alter table T_XYZ enable row movement;
    alter table T_XYZ shrink space;
  6. If you still want to free up some disk space back to the OS (As Oracle would have now reserved the total space that it was previously using), then you may have to resize the datafile itself:
    SQL> alter database datafile '/home/oracle/database/../XYZ.dbf' resize 1m;

For more details, please refer:
http://stage10.oaug.org/file/sroaug080229081203621527.pdf

2024-08-17 10:37:47

我会将数据导出到逗号分隔的文件中,以便可以将其导出到几乎任何数据库中。因此,如果您更改 Oracle 版本或几年后转向其他版本,您可以毫无顾虑地恢复它。

使用 SQL*Plus 的假脱机文件功能来执行此操作: http:// cisnet.baruch.cuny.edu/holowczak/oracle/sqlplus/# savingoutput

I would export the data to a comma-delimited file so it can be exported into almost any database. So if you change versions of Oracle or go to something else years later you can restore it without much concern.

Use the spool file feature of SQL*Plus to do this: http://cisnet.baruch.cuny.edu/holowczak/oracle/sqlplus/#savingoutput

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文