How to Remove and Drop Datafiles from Tablespace in Oracle Database Kā noņemt un Drop Datafiles no Tablespace in Oracle Database
Oracle RDBMS databases stores data logically in the form of tablespaces and physically in the form of data files. Oracle RDBMS datubāzēs uzglabā datu loģiski kā tablespaces un fiziski kā datu faili. The datafiles are added to the tablespaces as database space requirement grows bigger. Par datafiles ir papildināts ar tablespaces kā datubāze kosmosa prasība aug lielāka. However, there are several reasons you may want to remove or delete data files from a tablespace. Tomēr pastāv vairāki iemesli, jūs varētu vēlēties, lai novērstu vai dzēst datu failus no 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. Piemēram, nejauši pievienotu nepareizi lieluma vai nevēlamas datafile uz tablespace vai datu kosmosa lietojums ir kļuvis mazāks un dažas datu failus vēlaties jālikvidē, vai mēģināt atgūt Oracle datu bāzi, kas nespēj sākt trūkuma dēļ vai bojāti datafiles, atceļot tos , Oracle nesniedz viegls veids vai lietotāja interfeisu, lai dzēstu vai pilienu datafiles no 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. Kad datafile tiek daļa no tablespace, tas vairs nav iespējams atdalīt, vai izņem no tablespace, kaut gan ir vairāki workarounds.
How to Completely Drop the Whole Tablespace with All Datafiles Kā Pilnīgi Drop Visas Tablespace ar visām Datafiles
The easiest way to drop a or multiple datafiles is by dropping the entire tablespace together with its datafiles. Vieglākais veids, kā aizrakstīt vai daudzkāršu datafiles ir kritienizturības visu tablespace kopā ar tās 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. Ja jums vairs nav nepieciešama datu saturu, tablespace, šādu komandu būs nometiet tablespace, tad datafile, un tablespace saturu no datu vārdnīcai. All of the objects that where contained in that tablespace are permanently removed. Visi objekti, ka, ja šajā tablespace tiek neatgriezeniski izņemt.
DROP TABLESPACE <tablespace name> INCLUDING CONTENTS AND DATAFILES; DROP TABLESPACE <tablespace nosaukums> IESKAITOT saturu un 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). Ja nenorādāt "UN DATAFILES" Oracle netiks piliens fizisko datafile pēc DROP TABLESPACE komanda, bet jūs vienmēr varat izdzēst failus no operētājsistēmas apvalks (Ja datu faili ir bloķēta, restart server).
But always perform a backup of the database, as the “DROP TABLESPACE” command is irreversible. Bet vienmēr veikt backup no datubāzes, kā "DROP TABLESPACE" komanda ir neatgriezeniska. 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. Tas ir arī labs praksē pārbaudīt un noteikt, cik daudz datafiles a tablespace faktiski ir Pirms veikt piliens rīcību, lai izvairītos no kļūdu.
How to Check How Many Datafiles a Tablespace Has Kā pārbaudīt, cik daudz Datafiles a Tablespace Has
To determine and identify all datafiles that link to a tablespace, use the following query, with tablespace name in capital letter: Lai noteiktu un identificēt visu datafiles, ka saiti uz tablespace, tad izmanto šādu vaicājumu, ar tablespace vārds kapitāla burta:
SELECT file_name, tablespace_name SELECT FILE_NAME, tablespace_name
FROM dba_data_files NO dba_data_files
WHERE tablespace_name ='<tablespace name>'; KUR tablespace_name = '<tablespace nosaukums> ";
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. Ja tablespace satur vairākas datafiles, un jūs vienkārši vēlaties piliens vienu vai dažiem no datafiles un tur paliekot datafiles kopā ar objektiem un saturs, objektus vai datu jāeksportē par skārusi galda telpu. Once exported, the tablespace can be dropped with above “DROP TABLESPACE” command. Pēc tam, kad eksportētas, tablespace var kritās ar iepriekš "DROP TABLESPACE" komandu. Then, recreate the tablespace with the datafile(s) required (that you initially want to keep), and then import the objects into the recreated tablespace. Tad, atjaunotu tablespace ar datafile (s), kas vajadzīgs (ka jūs sākotnēji vēlaties saglabāt), un pēc tam importējiet objektu iekļaušana gaitai 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. Ja viena vai vairākas datafiles trūkst pēc atgūšanas procesa vai nejaušu izdzēšanu, varat izmantot ALTER DATABASE DATAFILE <datafile nosaukums> Offline DROP komanda, lai datafile bezsaistes tā, ka datu bāzē var sākšanas, pēc kura nemierīgajā tablespace var pārkāpties. (See (Skatīt instruction to recover from missing datafiles instrukciju, lai atgūtu no missing datafiles .) .)
How to Resize a Datafile to Minimum Size Kā Resize a Datafile lai Minimālais izmērs
Another alternative to drop the datafile is by shrinking the size of datafile instead of dropping. Vēl viena alternatīva nometiet datafile ir sarūk izmēru datafile vietā pārtraukt. This option is only possible if there is no extents in the datafile. Šis variants ir iespējams tikai tad, ja nav mērā, kas 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. Ja tādu nav, tas ir iespējams mainīt datu failu uz leju, lai ļoti nelielu failu (2 bloki), kur Oracle datu bāzi, vairs nekādus lielā mērā arī 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. Tomēr šo metodi, nav noņemiet datafile no tablespace ne izdzēst failu fiziski, bet tas samazinātu risku, jo nav datu būs atdalīta, jo tikai tukšs bloki ir samazināts. It simply makes it unusable and takes up almost close to no disk space. Tā vienkārši padara neizmantojamu un aizņem gandrīz tuvu nav vietu diskā. To resize a datafile, use the following query: Lai mainītu uz datafile, izmantojiet šādu jautājumu:
alter database datafile '<datafile name>' resize 8M; mainīt datu bāzē datafile "<datafile nosaukums>" izmainīsiet 8m;
How to Determine the Extents inside Datafile Kā Nosaka mērā iekšpusē Datafile
To check and determine the extents that exists in a datafile, use this query: Lai noskaidrotu un noteiktu mērā, ka pastāv a datafile, izmantojiet šo jautājumu:
SELECT owner, segment_name SELECT īpašnieks, segment_name
FROM dba_extents a, dba_data_files b NO dba_extents a, dba_data_files b
WHERE a.file_id = b.file_id KUR a.file_id = b.file_id
AND b.file_name = '<datafile name>' UN b.file_name = '<datafile nosaukums> "
IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: Šī lapa ir mašīna tulkoto un ar nosacījumu ", kas ir" bez garantijas. Machine translation may be difficult to understand. Machine translation var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.
Related Articles Saistītie raksti
- How Drop Tablespace and Recover Oracle Database When Accidentally Delete Datafile Kā Drop Tablespace un atgūt Oracle Database Kad nejauši Dzēst Datafile
- Oracle ORA-01658 Unable to Create INITIAL Extent for Segment in Tablespace Error Oracle ORA-01658 Nevar izveidot SĀKOTNĒJO mērā segmentā Tablespace kļūdu
- How to Rename or Move Oracle Tablespace Datafile to Another Location Kā, lai pārdēvētu vai Move Oracle Tablespace Datafile uz citu vietu
- Delete, Remove or Drop Oracle Stored Packages with Drop Package Svītrot, noņemt vai Drop Oracle Uzglabātajos komplekti ar Drop Package
- ORA-25153 Temporary Tablespace is Empty Error in Oracle ORA-25153 Pagaidu Tablespace ir tukšs Kļūda Oracle
- Oracle Database Link Oracle Database Link
- ORA-02449 Oracle Drop Table Error ORA-02449 Oracle Drop tabula kļūdu
- Change Oracle Database User Password Maina Oracle Database Lietotājs Parole
- Oracle Database Import Error 3113/3114 Oracle Database Import Error 3113/3114
- View and Retrieve Oracle Database Link Details View un paņemt Oracle Database Link detaļas










































August 4th, 2007 02:55 Augusts 4, 2007 02:55
[...] Tip: How to check datafiles that belong to tablespace. [...] Padoms: Kā pārbaudīt datafiles, kas pieder tablespace. [...] [...]