How to Remove and Drop Datafiles from Tablespace in Oracle Database Làm thế nào để Hủy bỏ và Thả Datafiles từ Tablespace trong cơ sở dữ liệu Oracle
Oracle RDBMS databases stores data logically in the form of tablespaces and physically in the form of data files. Oracle RDBMS lý cơ sở dữ liệu lưu trữ dữ liệu ở dạng tablespaces và thể chất trong các hình thức tập tin dữ liệu. The datafiles are added to the tablespaces as database space requirement grows bigger. Các datafiles được thêm vào cơ sở dữ liệu không gian tablespaces như yêu cầu phát triển lớn hơn. However, there are several reasons you may want to remove or delete data files from a tablespace. Tuy nhiên, có một số lý do bạn có thể muốn loại bỏ, hoặc xóa các tập tin dữ liệu từ một tablespace. Such as accidentally add a wrongly sized or unwanted datafile to a tablespace, or the data space usage has became smaller and some data files want to be removed, or attempt to recover Oracle database which fails to start due to missing or corrupted datafiles by removing them, Oracle does not provide an easy way or user interface to delete or drop datafiles from a tablespace. Chẳng hạn như vô tình thêm một sai kích cỡ hoặc không mong muốn datafile vào một tablespace, hoặc dữ liệu không gian sử dụng đã trở nên nhỏ hơn và một số tập tin dữ liệu muốn được gỡ bỏ, hoặc cố gắng khôi phục lại cơ sở dữ liệu Oracle mà không phải là thành công để bắt đầu do thiếu hoặc datafiles hỏng bằng cách bỏ chúng , Oracle không cung cấp một cách dễ dàng hoặc giao diện người dùng để xoá hoặc thả datafiles từ một tablespace. Once a datafile is made part of a tablespace, it can no longer be detached or removed from the tablespace, albeit there are several workarounds. Sau khi một datafile được làm một phần của một tablespace, nó có thể không còn được vô tư hoặc gỡ bỏ ra tablespace, albeit có một số workarounds.
How to Completely Drop the Whole Tablespace with All Datafiles Hoàn toàn Làm thế nào để thả các Whole Tablespace với Tất cả các Datafiles
The easiest way to drop a or multiple datafiles is by dropping the entire tablespace together with its datafiles. Cách dễ nhất để thả một hoặc nhiều datafiles là giảm toàn bộ tablespace cùng với các datafiles. If you no longer need the data contents of the tablespace, the following command will drop the tablespace, the datafile, and the tablespace's contents from the data dictionary. Nếu bạn không còn cần những dữ liệu nội dung của các tablespace, các lệnh sau đây sẽ thả các tablespace, các datafile và tablespace của nội dung từ các dữ liệu từ điển. All of the objects that where contained in that tablespace are permanently removed. Tất cả các đối tượng rằng, nơi mà chứa trong tablespace được xoá vĩnh viễn.
DROP TABLESPACE <tablespace name> INCLUDING CONTENTS AND DATAFILES; Thả TABLESPACE <tablespace name> BAO GỒM NỘI DUNG VÀ DATAFILES;
If you don't specify “AND DATAFILES”, Oracle will not drop the physical datafile after the DROP TABLESPACE command, but you can always delete the files from operating system shell (If the data files are locked, restart the server). Nếu bạn không xác định "và DATAFILES", Oracle sẽ không thả các vật lý datafile sau khi thả TABLESPACE lệnh, nhưng bạn luôn có thể xóa các tập tin từ hệ điều hành trình bao (Nếu các tập tin dữ liệu có khóa, khởi động lại máy phục vụ).
But always perform a backup of the database, as the “DROP TABLESPACE” command is irreversible. Tuy nhiên, luôn luôn thực hiện việc sao lưu dự phòng của các cơ sở dữ liệu, như là "thả TABLESPACE" lệnh là KHÔNG THỂ THAY ĐỔI. It's also a good practice to check and identify how many datafiles a tablespace actually has before performing the drop action in order to avoid mistake. Nó còn là một thực tế để kiểm tra và xác định có bao nhiêu datafiles một tablespace trên thực tế đã có trước khi thực hiện hành động thả để tránh nhầm lẫn.
How to Check How Many Datafiles a Tablespace Has Làm thế nào để Kiểm tra như thế nào Nhiều Datafiles Có một Tablespace
To determine and identify all datafiles that link to a tablespace, use the following query, with tablespace name in capital letter: Để xác định và xác định rằng tất cả các datafiles liên kết đến một tablespace, sử dụng truy vấn sau đây, với vốn đầu tư trong tablespace tên chữ:
SELECT file_name, tablespace_name CHỌN FILE_NAME, tablespace_name
FROM dba_data_files TỪ dba_data_files
WHERE tablespace_name ='<tablespace name>'; Tìm tablespace_name = '<tablespace name>';
If a tablespace contains multiple datafiles, and you just want to drop one or some of the datafiles and keep the remaining datafiles together with the objects and contents, the objects or data must be exported for the affected table space. Nếu một tablespace có chứa nhiều datafiles, và bạn chỉ muốn thả một hoặc một số các datafiles và giữ datafiles còn lại cùng với các đối tượng và nội dung, đối tượng hoặc dữ liệu phải được xuất khẩu cho các bảng không gian bị ảnh hưởng. Once exported, the tablespace can be dropped with above “DROP TABLESPACE” command. Sau khi xuất khẩu, các tablespace có thể được bỏ với ở trên "thả TABLESPACE" lệnh. Then, recreate the tablespace with the datafile(s) required (that you initially want to keep), and then import the objects into the recreated tablespace. Sau đó, các tablespace lí với các datafile (s) yêu cầu (ban đầu mà bạn muốn giữ lại), và sau đó nhập khẩu các đối tượng vào recreated tablespace.
If one or more datafiles is missing after a recovery process or accidental deletion, you can use ALTER DATABASE DATAFILE <datafile name> OFFLINE DROP command to make the datafile offline so that database can starts up after which the troubled tablespace can be dropped. Nếu một hoặc nhiều datafiles là mất tích sau khi một quá trình khôi phục hoặc xóa tình cờ, bạn có thể sử dụng thay đổi cơ sở dữ liệu DATAFILE <datafile name> Offline thả lệnh để làm cho datafile ngoại tuyến để các cơ sở dữ liệu có thể bắt đầu sau khi lên mà không tablespace có thể được bỏ. (See (Xem instruction to recover from missing datafiles hướng dẫn việc phục hồi từ thiếu datafiles .) .)
How to Resize a Datafile to Minimum Size Làm thế nào để Resize một Datafile Kích thước tối thiểu để
Another alternative to drop the datafile is by shrinking the size of datafile instead of dropping. Khác để thay thế cho thả các datafile của shrinking là kích thước của datafile thay vì rơi. This option is only possible if there is no extents in the datafile. Tùy chọn này chỉ có thể được nếu không có sự extents trong datafile. If there are none, it's possible to resize the data file down to a very small file (2 blocks), where Oracle database will no longer create any extent in the datafile. Nếu có không có gì, có thể để thay đổi kích cỡ của tập tin dữ liệu xuống một tập tin rất nhỏ (2 khối), nơi Oracle cơ sở dữ liệu sẽ không còn tạo ra bất kỳ mức độ trong datafile. However, this workaround does not remove the datafile from tablespace nor delete the file physically, but it reduce the risk as no data will be truncated as only empty blocks are reduced. Tuy nhiên, điều này workaround không xóa các datafile từ tablespace cũng không xóa các tập tin thể chất, nhưng nó làm giảm các nguy cơ như không có dữ liệu sẽ được rút ngắn như là khối trống rỗng, chỉ là giảm. It simply makes it unusable and takes up almost close to no disk space. Nó đơn giản chỉ làm cho nó unusable và sẽ lên gần gần như không có không gian đĩa. To resize a datafile, use the following query: Để thay đổi kích cỡ của một datafile, sử dụng truy vấn sau đây:
alter database datafile '<datafile name>' resize 8M; thay đổi cơ sở dữ liệu datafile '<datafile name>' thay đổi kích cỡ 8m;
How to Determine the Extents inside Datafile Làm thế nào để Xác định các Extents bên trong Datafile
To check and determine the extents that exists in a datafile, use this query: Để kiểm tra và xác định rằng extents có thể có được ở datafile, hãy sử dụng các truy vấn này:
SELECT owner, segment_name CHỌN chủ sở hữu, segment_name
FROM dba_extents a, dba_data_files b TỪ dba_extents a, b dba_data_files
WHERE a.file_id = b.file_id Tìm a.file_id = b.file_id
AND b.file_name = '<datafile name>' VÀ b.file_name = '<datafile name>'
IMPORTANT : The page is machine translated and provided "as is" without warranty. Lưu ý: Các trang web là máy tính dịch và cung cấp "như là" mà không có bảo hành. Machine translation may be difficult to understand. Máy dịch thuật có thể là khó hiểu. Please refer to Xin vui lòng tham khảo original English article Tiếng Anh bản gốc bài viết whenever possible. bất cứ khi nào có thể.
Related Articles Bài viết liên quan
- How Drop Tablespace and Recover Oracle Database When Accidentally Delete Datafile Làm thế nào Thả Tablespace và Cơ sở dữ liệu Oracle Recover Khi vô tình Xóa Datafile
- Oracle ORA-01658 Unable to Create INITIAL Extent for Segment in Tablespace Error Oracle ORA-01658 Không thể Tạo Initial Mức cho phân trong Tablespace Lỗi
- How to Rename or Move Oracle Tablespace Datafile to Another Location Làm thế nào để Đổi tên hoặc Di chuyển Oracle Tablespace Datafile đến địa điểm khác
- ORA-25153 Temporary Tablespace is Empty Error in Oracle ORA-25153 tạm thời Tablespace đang rỗng Lỗi trong Oracle
- Delete, Remove or Drop Oracle Stored Packages with Drop Package Xóa, hoặc Hủy bỏ Thả Oracle lưu trữ trọn gói trọn gói với Thả
- Oracle Database Link Cơ sở dữ liệu Oracle Liên kết
- Change Oracle Database User Password Cơ sở dữ liệu Oracle thay đổi người dùng Mật khẩu
- ORA-02449 Oracle Drop Table Error ORA-02449 Oracle Thả Bảng Lỗi
- Oracle Database Import Error 3113/3114 Cơ sở dữ liệu Oracle Nhập Lỗi 3113/3114
- View and Retrieve Oracle Database Link Details Xem và Taíi Oracle cơ sở dữ liệu liên kết Chi tiết










































August 4th, 2007 02:55 4 tháng tám, 2007 02:55
[...] Tip: How to check datafiles that belong to tablespace. [...] Mẹo: Làm thế nào để kiểm tra rằng datafiles thuộc tablespace. [...] [...]