MOVE PARTITION This ALTER TABLE option moves a table partition to another segment. MOVE PARTITION always drops the partition's old segment and creates a new segment, even if you do not specify a new tablespace.If partition_name is not empty, MOVE PARTITION s all corresponding local index partitions and all global non-partitioned indexes, and all the partitions of global partitioned indexes as unusable. ALTER TABLE MOVE PARTITION obtains its parallel attribute from the PARALLEL clause, if specified. If not specified, the default PARALLEL attributes of the table, if any, are used. If neither is specified, it performs the move without using parallelism.The PARALLEL clause on MOVE PARTITION does not change the default PARALLEL attributes of table.The following example moves partition STATION3 to tablespace TS097:ALTER TABLE trains
MOVE PARTITION station3 TABLESPACE ts097 NOLOGGING;
MOVE PARTITION station3 TABLESPACE ts097 NOLOGGING;
以下一个例子:
DECLARE
v_StudentID students.id%TYPE;
v_FirstName students.first_name%TYPE;
v_LastName students.last_name%TYPE; -- Cursor to retrieve the information about History students
CURSOR c_HistoryStudents IS
SELECT id, first_name, last_name
FROM students
WHERE major = 'History';
BEGIN
-- Open the cursor and initialize the active set
OPEN c_HistoryStudents;
LOOP
-- Retrieve information for the next student
FETCH c_HistoryStudents INTO v_StudentID, v_FirstName, v_LastName; -- Exit loop when there are no more rows to fetch
EXIT WHEN c_HistoryStudents%NOTFOUND; -- Process the fetched rows. In this case sign up each
-- student for History 301 by inserting them into the
-- registered_students table. Record the first and last
-- names in temp_table as well.
INSERT INTO registered_students (student_id, department, course)
VALUES (v_StudentID, 'HIS', 301); INSERT INTO temp_table (num_col, char_col)
VALUES (v_StudentID, v_FirstName || ' ' || v_LastName); END LOOP; -- Free resources used by the cursor
CLOSE c_HistoryStudents;
END;
/