Saturday, June 29, 2024
SET SERVEROUTPUT ON
DECLARE
v_owner VARCHAR2(30) := 'YOUR_SCHEMA_NAME'; -- Replace with your schema name
v_new_tablespace VARCHAR2(30) := 'NEW_TABLESPACE'; -- Replace with your new tablespace name
BEGIN
FOR rec IN (
SELECT DISTINCT tablespace_name
FROM dba_segments
WHERE owner = v_owner
AND tablespace_name IS NOT NULL
) LOOP
DBMS_OUTPUT.PUT_LINE('REMAP_TABLESPACE=' || rec.tablespace_name || ':' || v_new_tablespace);
END LOOP;
END;
/