Sybase
Материал из noname.com.ua
Sybase
Поленые ф-и
Информация по базе
sp_helpdb db_name
Создать "утройство" (файл или утройство для данных)
disk init name = "cmm_db_data_2", physname = "/sybase_devices/cmm_db_data_2.dat", size = "5000M"
Добавить это устройство к базе.
ALTER database cmm_db on cmm_db_data_2 = "5000M"
Размеры таблиц
CREATE PROCEDURE dbo.CalcFreeSpace AS BEGIN DECLARE @CurrentTableName NVARCHAR(100) CREATE TABLE #TableList (TableName NVARCHAR(100) , RowsCount INT , KBReserved VARCHAR(15) , KBData VARCHAR(15) , KBIndex VARCHAR(15) , KBUnused VARCHAR(15) ) -- Run a cursor through all of the tables DECLARE result_cursor CURSOR FOR SELECT name FROM dbo.sysobjects WHERE type = 'U' OPEN result_cursor FETCH NEXT FROM result_cursor INTO @CurrentTableName WHILE @@FETCH_STATUS = 0 BEGIN exec sp_spaceused @CurrentTableName FETCH NEXT FROM result_cursor INTO @CurrentTableName END --end loop --clean up CLOSE result_cursor DEALLOCATE result_cursor --UPDATE #TableList -- SET KBReserved = REPLACE(KBReserved, ' KB', '') -- , KBData = REPLACE(KBData, ' KB', '') -- , KBIndex = REPLACE(KBIndex, ' KB', '') -- , KBUnused = REPLACE(KBUnused, ' KB', '') /* Adaptive Server has expanded all '*' elements in the following statement */ SELECT #TableList.TableName, #TableList.RowsCount, #TableList.KBReserved, #TableList.KBData, #TableList.KBIndex, #TableList.KBUnused FROM #TableList ORDER BY TableName DROP TABLE #TableList END
Дамп и восстановление
Для дампа и восстановления ТАБЛИЦ используется утилита bcp .
Подробнее почитать тут http://manuals.sybase.com/onlinebooks/group-as/asg1250e/util/@Generic__BookTextView/10086;pt=8630/*
Для дампа базы целиком используется isql:
isql 1> dump database cmm_db 2> to "./cmm_db.dump" 3> go Backup Server session id is: 70. Use this value when executing the 'sp_volchanged' system stored procedure after fulfilling any volume change request from the Backup Server. Backup Server: 4.41.1.1: Creating new disk file /DBAPP1/sybase/./cmm_db.dump. Backup Server: 6.28.1.1: Dumpfile name 'cmm_db111080E7CC ' section number 1 mounted on disk file '/DBAPP1/sybase/./cmm_db.dump' Backup Server: 4.188.1.1: Database cmm_db: 105464 kilobytes (1%) DUMPED. ... Backup Server: 4.188.1.1: Database cmm_db: 8601706 kilobytes (73%) DUMPED. Backup Server: 3.43.1.1: Dump phase number 1 completed. Backup Server: 3.43.1.1: Dump phase number 2 completed. Backup Server: 3.43.1.1: Dump phase number 3 completed. Backup Server: 4.188.1.1: Database cmm_db: 8663424 kilobytes (100%) DUMPED. Backup Server: 3.42.1.1: DUMP is complete (database cmm_db).
При этом дамп будет сохранен на сервере БД а не на том хосте где запускался isql